#153. 整数十位取整求和

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

整数十位取整求和

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 1010 if its rightmost digit is 55 or more, so 1515 rounds up to 2020. Alternately, round down to the previous multiple of 1010 if its rightmost digit is less than 55, so 1212 rounds down to 1010. Given 33 ints, a,b,ca, b, c, return the sum of their rounded values. To avoid code repetition, write a separate helper public int round10(int num) and call it 33 times. Write the helper entirely below and at the same indent level as roundSum().

Input Format

Input consists of three integers a,b,ca, b, c.

a b c

Output Format

Output a single integer, the sum of the rounded values of a,b,ca, b, c.

sum

Sample

16 17 18
60
12 13 14
30
6 4 4
10

Sample Explanation

Sample 1: 1616 rounds up to 2020, 1717 rounds up to 2020, 1818 rounds up to 2020. Total sum is 20+20+20=6020 + 20 + 20 = 60.

Sample 2: 1212 rounds down to 1010, 1313 rounds down to 1010, 1414 rounds down to 1010. Total sum is 10+10+10=3010 + 10 + 10 = 30.

Sample 3: 66 rounds up to 1010, 44 rounds down to 00, 44 rounds down to 00. Total sum is 10+0+0=1010 + 0 + 0 = 10.

Constraints

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