#252. 条件差值计算

    ID: 252 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatWarmup-1gesp1条件结构数学基础

条件差值计算

Difference Calculation

Background

Congcong has recently been learning about numerical operations. He encountered an interesting problem that requires calculating the difference between a given integer and a specific number, and doubling it under certain conditions.

Problem Description

Given an integer nn, return the absolute difference between nn and 2121. However, if nn is over 2121, return double the absolute difference.

Input Format

Input is given from standard input in the following format.

nn

Output Format

Output is printed to standard output in the following format.

The calculated result

Sample

19
2
10
11
21
0

Sample Explanation

Sample 1: n=19n=19. 1919 is not greater than 2121, so return 1921=2=2|19 - 21| = |-2| = 2. Sample 2: n=10n=10. 1010 is not greater than 2121, so return 1021=11=11|10 - 21| = |-11| = 11. Sample 3: n=21n=21. 2121 is not greater than 2121, so return 2121=0=0|21 - 21| = |0| = 0.

Constraints

Time limit is 11 second, and memory limit is 10241024 KiB for each test case.