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

9637번 - The Stones Game 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB59242340.351%

문제

The stones game is a simple game, it is also a very old game which is unknown to almost everyone.

The game starts with N stones and M players, the players are numbered from 1 to M. The players play in turns, player number 1 plays first, then player number 2 and so on until player number M plays, after this player number 1 plays again and they keep playing until the end of the game.

For each turn, the players do the following 2 steps:

  1. The player gets a chance to remove a stone, and he/she should remove a stone in this step if he/she decided to do so.
  2. Regardless of the decision of the current player (whether or not he/she removed a stone in the first step), if this is not the first turn and in the previous turn the player decided not to remove a stone in his/her first step, then the current player must remove a stone in this step (if in the previous turn the player decided to remove a stone in his/her first step, then the current player must not remove a stone in this step).

This means in some turns a player might remove 0, 1 or 2 stones according to the above rules. In this game, the player who removes the last stone wins the game.

Now you are given the total number of stones, the total number of players and a player number and you are asked to answer the following question:

Is there a strategy for this player to win the game regardless of the actions taken by the other players in their turns?

입력

Your program will be tested on one or more test cases. The first line of the input will be a single integer T, the number of test cases (1 ≤ T ≤ 100). Followed by the test cases, each test case is described in one line which contains 3 integers separated by a single space N M X (1 ≤ N , M ≤ 109) and (1 ≤ X ≤ M) representing the number of stones, the number of players and the player number, respectively.

출력

For each test case, print a single line which contains a single word, this word is either “YES” or “NO” (without the quotes) representing the answer for the above question for the given player number.

제한

예제 입력 1

2
2 2 2
2 2 1

예제 출력 1

YES
NO

힌트

출처

ICPC > Regionals > Africa and Arab > Arab Collegiate Programming Contest > 2013 Arab Collegiate Programming Contest G번

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

출처

대학교 대회

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

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