Submit | All submissions | Best solutions | Back to list |
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.
Explanation:
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).
Input
Every line of the input contains a single integer N denoting the lucky pizza number.
Constraints
- 1 ≤ N ≤ 109
Output
For each test case, print a single line and print the name of the lucky winner.
Example
Input: 1 2 3 Output: Asad Foyj Juwel
Added by: | asad_IT |
Date: | 2018-06-24 |
Time limit: | 0.5s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | Adhoc |
hide comments
|
|||||
2020-07-29 18:39:28 David
Note on input format: Read until EOF. |
|||||
2020-06-01 12:48:19
it gives me run time error ! how many test cases the author didn't specify it |
|||||
2018-07-01 12:12:10
Every item popped from the front of the queue gets added twice at the end. Write a simulation and see what happens! |
|||||
2018-06-28 20:26:15
can anyone explain what will happen after third time will he get 3 chances or 4 chances or only 2 chances? |
|||||
2018-06-28 07:18:24 shravinson
silly calculation mistake cause me 1 WA..... nice problem........ |
|||||
2018-06-25 15:03:28
At least the problem setter should clearly mention about the input format. For all others please read the input to end of file. |
|||||
2018-06-25 13:23:04
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............. |
|||||
2018-06-25 13:09:13
@asad_IT please make it clear in the input format to read input until end of file. The current explanation seems dubious. |
|||||
2018-06-24 21:30:08
spelling mistake cause me 1WA :( |
|||||
2018-06-24 18:22:13
don't know why it shows WA |