Back to Problem Solutions forum
Why i have wrong answer Input : 10037 99 Correct answer : 10411732961 My answer : 10409042975
If you read problem statement carefully, you probably noticed that:
"Note that on even-numbered seconds monks at first distribute food among the visitors already waiting in the queue and only then receive a newcomer."
So just swap in your program first if statement and block (receiving newcomer) with second if statement + block (food distribution) and you should get right answer.
P. S. Yeah, for example provided in problem statement original program makes right answer, but it is just luck :)...
thank you qwerty-one, i have done solve this problem :)