Submit | All submissions | Best solutions | Back to list |
SYNC13C - WHAT A CO-ACCIDENT |
Ramesh and Suresh get a box full of five stars on lottery each. Since both the boxes need not have the same number of chocolates, they decide to play a game. The winner gets to have both the boxes of chocolates. They play alternatively and Suresh starts the game.
Given the number of chocolates in both the boxes, let them be c1 and c2, the player takes either c1 or c2 number of chocolates and divide the remaining box of chocolates to two boxes (these two boxes need not have the same number of chocolates). The player who cannot make such a move loses.
Given the initial number of chocolates (c1 and c2) find the winner.Assume both the players play optimally.
Input
First line of input contains a number T (1 <= T <= 1000), the number of test cases. Then follows T lines each containing two space separated integers c1 and c2
(1 <= c1 <= c2 <= 10000).
Output
For each test case print "Ramesh
" or "Suresh
" depending on who is the winner.
Example
Input: 2 3 1 4 5 Output: Ramesh Suresh
Added by: | Pandian |
Date: | 2013-12-19 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
|
||||||||
2014-01-18 12:36:44 joud zouzou
Great Problem |
||||||||
2014-01-06 21:31:35 anurag garg
AC......finally |
||||||||
2014-01-04 13:21:29 Kanish
nice one!! Last edit: 2014-01-04 13:21:41 |
||||||||
2014-01-02 15:18:49 Kevin Sebastian
good problem |
||||||||
2014-01-02 09:33:09 johri
nice :) Hit & trial ..!! |
||||||||
2014-01-02 08:06:41 கைபà¯à®³à¯à®³
@Sachith (3,1) chooses(suresh) 1, 3->(2,1) chooses(ramesh) 1, 2->(1,1) now suresh can't divide 1 so lost the game. please someone explain case 2. |
||||||||
2014-01-01 19:21:12 Sachith
how is winner decided?? can someone explain the first case? Last edit: 2014-01-01 19:23:50 |
||||||||
2014-01-01 10:01:51 [Lakshman]
@lokesh k Took pen and paper and try to solve it for small values of C1 and C2. I solved this problem using hit and trial method. |
||||||||
2014-01-01 08:21:42 கைபà¯à®³à¯à®³
@Pandian some more test cases please. |
||||||||
2013-12-31 09:50:00 ritz
amazing problem :) (Y) Last edit: 2013-12-31 09:50:20 |