#abc273b. B - Broken Rounding
B - Broken Rounding
Score : points
问题描述
给定一个非负整数 ,按照顺序对 执行以下操作,并找出最终的 。
- 将 四舍五入到最接近的 。
- 正式地说,将 替换为 “使 最小的最大 的倍数” 的 。
- 这里有一些示例:
- 将 四舍五入到最接近的 得到 。
- 将 四舍五入到最接近的 得到 。
- 将 四舍五入到最接近的 得到 。
- 将 四舍五入到最接近的 得到 。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
Given a non-negative integer , perform the following operation for in this order and find the resulting .
- Round off to the nearest .
- Formally, replace with that is "the largest multiple of that minimizes ."
- Here are some examples:
- Rounding off to the nearest yields .
- Rounding off to the nearest yields .
- Rounding off to the nearest yields .
- Rounding off to the nearest yields .
Constraints
- and are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer as an integer.
Sample Input 1
2048 2
Sample Output 1
2100
changes as by the operations.
Sample Input 2
1 15
Sample Output 2
0
Sample Input 3
999 3
Sample Output 3
1000
Sample Input 4
314159265358979 12
Sample Output 4
314000000000000
may not fit into a -bit integer type.
update @ 2024/3/10 11:29:45