Edinburgh Competition 2019 |
---|
Finished |
Let's say we would like to give change of $$$d$$$ dollars after a puchase of coffee. The only coins that we can use have values $$$a$$$, $$$a+1$$$, ..., $$$b$$$. Is it possible to give out the change? We are interested in even harder quesion: for given $$$d$$$ and $$$a$$$ what is the smallest $$$b$$$ such that the change can be given?
The input is two numbers $$$1\leq a\leq d\leq 10^9$$$.
Print smallest $$$b$$$ such that $$$d$$$ is a sum of coins from range $$$a, ..., b$$$.
19 60
20
100 914
102
Name |
---|