#153. 整数十位取整求和
整数十位取整求和
Sum of Rounded Values
Background
Dawei assigned a practice problem about integer rounding.
Problem Description
For this problem, we'll round an int value up to the next multiple of if its rightmost digit is or more, so rounds up to . Alternately, round down to the previous multiple of if its rightmost digit is less than , so rounds down to . Given ints, , return the sum of their rounded values. To avoid code repetition, write a separate helper public int round10(int num) and call it times. Write the helper entirely below and at the same indent level as roundSum().
Input Format
Input consists of three integers .
a b c
Output Format
Output a single integer, the sum of the rounded values of .
sum
Sample
16 17 18
60
12 13 14
30
6 4 4
10
Sample Explanation
Sample 1: rounds up to , rounds up to , rounds up to . Total sum is .
Sample 2: rounds down to , rounds down to , rounds down to . Total sum is .
Sample 3: rounds up to , rounds down to , rounds down to . Total sum is .
Constraints
Time limit for each test case is second, and memory limit is KiB.