#P7258. [COCI 2009/2010 #3] SLATKISI
[COCI 2009/2010 #3] SLATKISI
Description
He cannot always pay the exact amount, so the shop owner made an agreement with him.
He tells the shop owner the smallest banknote he has, and the shop owner rounds the price to the closest number that he can pay.
For example, if Mirko’s smallest banknote is dollars and he wants to buy dollars of candy, the shop owner rounds the price to dollars. If he wants to buy dollars of candy, the shop owner rounds the price to dollars.
Recently, Mirko suspects that the shop owner wants to cheat him. Please determine whether the shop owner has cheated him.
Mirko’s mom only gives him banknotes of dollars, and he has infinitely many of these banknotes.
Input Format
The first line contains two integers, , representing the price of the candy Mirko wants to buy and the number of zeros on Mirko’s smallest banknote. Here, “number of zeros” means the exponent in .
Output Format
The first line contains one integer: rounded to the closest amount that Mirko can pay.
184 1
180
123450995 1
123451000
182 2
200
Hint
Constraints
For of the testdata, , .
Notes
Translated from COCI 2009-2010 #3 T2 SLATKISI. Full score is 50 points, 5 points per test, with 10 tests in total.
Translated by ChatGPT 5
京公网安备 11011102002149号