CDRN01 - Editorial

PROBLEM LINK:

Practice
Contest

Setter: Prateek Bhardwaj
Tester: Jatin Nagpal
Editorialist: Jatin Nagpal

DIFFICULTY:
CAKEWALK

PREREQUISITES:
Maths

EXPLANATION:
First of all, you had to round off the number to the smallest multiple of 10 which is \geq B, as Robin carries only 10 rupee notes and he has to pay atleast B.

Now if the amount is multiple of 100(which covers multiple of 1000 case), simply add 10 to it. This number won’t be multiple of 100(or 1000).

Time Complexity:
O(1)

AUTHOR’S AND TESTER’S SOLUTIONS:
Author’s solution can be found here
Tester’s solution can be found here

1 Like