Logo
(追記) (追記ここまで)

30134번 - Pile it down 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
6 초 1024 MB143321.429%

문제

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:

  • Remove any number of coins from a single pile.
  • Remove equal number of coins from both piles.
  • Pass on the turn to the next player. Note that this still counts as a turn.

The game ends when no move is possible and the player who cannot make a move loses. Both players play optimally. Being smart, both players calculate the outcome of the game before the game begins. The player who loses tries to maximize the number of turns in the game and player who wins tries to minimize the turns. No player can pass more than P times. Sita starts the game.

입력

The first line of input will contain an integer T ≤ 200 denoting the number of test cases.

Each test case will contain a single line formatted as follows:-

X Y P

출력

Output one line per case.

The name of the winner and the number of moves in the game separated by a single space.

제한

  • 0 ≤ X ≤ 1000
  • 0 ≤ Y ≤ 1000
  • 0 ≤ P ≤ 100

예제 입력 1

2
3 4 0
4 5 1

예제 출력 1

Sita 3
Sita 5 

힌트

출처

ICPC > Regionals > Asia West Continent > India > The 2008 Asia Amritapuri Contest F번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /