Rounding
Time limit2sMemory limit128 MB
Given an integer up to 99,999,999, repeatedly round its digits at increasing place values (tens, hundreds, etc.) using standard rounding rules and print the final result.
- Level
Easy3 of 10
- Topics
- Math, Implementation, Simulation
- Solved
- No attempts yet
Problem
You are given an integer N. If the current value is greater than 10, round the ones digit to make it a multiple of 10. If the result is greater than 100, round the tens digit to make it a multiple of 100. Continue in the same way: whenever the current value is greater than the next threshold, round the digit immediately below that threshold.
When rounding a digit, values 5 or greater round up, and values 4 or less round down. Print the value after no more rounding steps are required.
Input
The first line contains an integer N.
0 <= N <= 99,999,999
Output
Print the value after applying the full rounding process.