Theodore likes to keep in touch with his friends at all times, even when he does homework. Unfortunately, sending and receiving a lot of messages from his friends has caused him to be distracted from doing his very important math homework.
To remedy this issue, Theodore has decided to only check his messages at set intervals of time, starting at some minute. For example, starting at minute , Theodore might decide that he wants to check his messages every minutes. Given this set interval the first time he checks his messages will be at minute . While studying, Theodore only accounts for the minutes he spends on his homework, disregarding the typical clock format of telling time. Theodore starts his homework at a certain time and decides to check his messages three times, separated by an interval.
Larry sends Theodore a message some time later. Given the interval Theodore uses to checks his messages, when will he read Larry's message?
Input Specification
The first line of input will consist of a single integer, the minute that Theodore starts doing his homework at.
The next line of input will consist of a single integer, the interval that Theodore wants to check his messages at.
The last line of input will consist of a single integer, the minute when Larry sent Theodore a message.
All integers in the input will be between and .
For of the points, Larry will always send his message after Theodore last checked his phone.
Output Specification
Output the first time when Theodore will see Larry's message. If Larry's message is sent after the last time Theodore checks his phone, output Who knows...
.
Sample Input 1
1
30
91
Sample Output 1
91
Explanation for Sample Output 1
The first time Theodore decides to check his messages is exactly minutes after minute , .
The second time Theodore checks his messages is minutes after the first time, .
The third time Theodore checks his messages is minutes after the second time, .
Larry sends his message just as Theo checks his messages for the last time at minutes.
Sample Input 2
5
19
4
Sample Output 2
24
Explanation for Sample Output 2
Theodore will see Larry's message the first time he checks them, at minutes.
Sample Input 3
2
10
99
Sample Output 3
Who knows...
Comments
What am I missing?? The 3 samples work fine, but the judge fails on Batch 2, Case 3 (Side question: does a failed case always stop the process? I.e. not further cases are tested?)
I suggest using the <= operator instead, so you can compare if m <= cktime1, cktime2, cktime3.
Also for batches, I'm pretty sure that if you don't pass a test case in a batch it just terminates that batch and then jumps to the next one.
this works with all the test data but not the solution data for some reason? any ideas
Hi, I think the condition is that he checks only 3 times. so any message after the 3rd time is outputted as "who know ..."
Anyone having trouble getting this to work? I can only get 30 points and can't figure out what I'm missing.