406465: GYM102416 C Quick coffee
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
C. Quick coffeetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
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?
InputThe input is two numbers $$$1\leq a\leq d\leq 10^9$$$.
OutputPrint smallest $$$b$$$ such that $$$d$$$ is a sum of coins from range $$$a, ..., b$$$.
ExamplesInput19 60Output
20Input
100 914Output
102