#168. 最接近10的值
最接近10的值
Nearest to 10
Background
Congcong is learning how to compare numbers. He wants to find out which of two given numbers is closer to a specific target value.
Problem Description
Given 2 int values, return whichever value is nearest to the value 10, or return 0 in the event of a tie. Note that Math.abs(n) returns the absolute value of a number.
Input Format
Input is given from standard input in the following format.
Two integers and .
Output Format
Output is printed to standard output in the following format.
An integer representing the value nearest to 10, or 0 if tied.
Sample
8 13
8
13 8
8
13 7
0
Sample Explanation
Sample 1: The absolute distance of from is . The absolute distance of from is . is closer to , so is returned.
Sample 2: The absolute distance of from is . The absolute distance of from is . is closer to , so is returned.
Sample 3: The absolute distance of from is . The absolute distance of from is . Both are equally distant from , so is returned.
Constraints
Time limit: second, Memory limit: KiB for each test case.