TopCoder

User's AC Ratio

100.0% (3/3)

Submission's AC Ratio

100.0% (3/3)

Tags

Description

學校走廊有一條長長的捲尺貼在地板上,捲尺上有連續的整數刻度,中間的 0 是校長室門口,往右是正數、往左是負數。

小花站在位置 A,小明站在位置 B(兩人都是整數刻度,可能在零的任一側)。

請計算小花和小明之間相差幾個刻度,也就是 A、B 兩點在數線上的距離。

子任務說明

子任務1:

範例測資

子任務2:

對於所有的 $ A, B$ , $ A \ge B$

子任務3:

對於所有的 $ A, B$ , $ A \le B$

子任務4:

沒有題目敘述(含輸入格式 Input Format 說明)之外的限制

Input Format

輸入為兩個用空白字元分隔的整數 $ A, B (-10^6 \le A, B \le 10^6) $

Output Format

一個非負整數,表示 A, B 的距離

Sample Input 1

9 8

Sample Output 1

1

Sample Input 2

-3 15

Sample Output 2

18

Hints

Problem Source

內高 115 資訊學科能力競賽-校內初賽

Subtasks

No. Testdata Range Score
1 0~1 0
2 2~6 30
3 7~11 30
4 12~28 40

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 65536 65536 1
1 1000 65536 65536 1
2 1000 65536 65536 2
3 1000 65536 65536 2
4 1000 65536 65536 2
5 1000 65536 65536 2
6 1000 65536 65536 2
7 1000 65536 65536 3
8 1000 65536 65536 3
9 1000 65536 65536 3
10 1000 65536 65536 3
11 1000 65536 65536 3
12 1000 65536 65536 4
13 1000 65536 65536 4
14 1000 65536 65536 4
15 1000 65536 65536 4
16 1000 65536 65536 4
17 1000 65536 65536 4
18 1000 65536 65536 4
19 1000 65536 65536 4
20 1000 65536 65536 4
21 1000 65536 65536 4
22 1000 65536 65536 4
23 1000 65536 65536 4
24 1000 65536 65536 4
25 1000 65536 65536 4
26 1000 65536 65536 4
27 1000 65536 65536 4
28 1000 65536 65536 4