Sita and Gita are smart kids. Generally after completing their homework they go out for some
outdoor games. But it's raining today and they have to stay home. They decide to break their
piggy-bank and count their savings. They find out that they have accumulated many coins over
the last few months and decide to play a game with these coins. First they divide the coins into 2
piles containing X and Y coins respectively.
Now they start the game by alternating turns. In each turn a player can do one of the following:
The first line of input will contain an integer T <= 100,000 denoting the number of test cases.
Each test case will contain a single line formatted as follows:-
X Y P
0<=X<=1,000,000
0<=Y<=1,000,000
0<=P<=100
Output one line per case.
The name of the winner and the number of moves in the game separated by a single space.
2 3 4 0 4 5 1
Sita 3 Sita 5
Migrated from old NTUJ.
ICPC 2008, Amritapuri
No. | Testdata Range | Score |
---|