PPR - Pizza Prize
Asad,Foyj,Juwel,Mijan,Tanmay are friends from group "Mission Starts".They are in the queue for Pizza in a bakery. No other people is in the queue. A person who takes one pizza can get two chances to get pizza at the end of queue.
Initial Chances queue: Asad, Foyj, Juwel, Mijan, Tanmay .
After taking 1st pizza the Chances queue: Foyj, Juwel, Mijan, Tanmay, Asad, Asad.
After taking 2nd pizza the Chances queue: Juwel, Mijan, Tanmay, Asad, Asad, Foyj, Foyj.
And So on……..
But the shopkeeper wants to offer a special prize to a person who have the N th pizza.In this case, He asks for your help. You are a great programmer in our country. Your task is to find the name of the lucky winner who have the N th pizza(the queue only contain these 5 peoples and their order should be maintained strictly).
Every line of the input contains a single integer N denoting the lucky pizza number.
- 1 ≤ N ≤ 109
For each test case, print a single line and print the name of the lucky winner.
Input: 1 2 3 Output: Asad Foyj Juwel
Every item popped from the front of the queue gets added twice at the end. Write a simulation and see what happens!
can anyone explain what will happen after third time will he get 3 chances or 4 chances or only 2 chances?
silly calculation mistake cause me 1 WA.....
At least the problem setter should clearly mention about the input format.
guys pls tell for the third time Asad will get 3 pizza and fourth time four || third time 4 and fourth time 8 and so on.............
@asad_IT please make it clear in the input format to read input until end of file. The current explanation seems dubious.
spelling mistake cause me 1WA :(
don't know why it shows WA
Nice question . But please specify the input format .Last edit: 2018-06-26 11:33:12
Hey input format is correct??