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

11334번 - Coin Turning Game 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB35161246.154%

문제

Alice and Bob are playing the following game (Alice plays first):

They start with an arrangement of N coins in a row (some of them showing heads and some of them showing tails) At each player's turn, they can flip any number of consecutive coins but the rightmost one has to go from head to tail. Whoever is unable to make a move loses.

Given the initial arrangement of coins, if both Alice and Bob play optimally, can Alice win the game?

입력

First line of the input contains an integer T (1 <= T <= 100) - the number of test cases. Each test case consist of a single line containing a string S (3 <= |S| <= 15) - the initial arrangement of coins. Each character of S will be either 'H' or 'T' (telling us if heads or tails are up).

출력

For each test case determine if Alice can win the game if both she and Bob play optimally. If she can, print "YES" followed by two integers - the position of the rightmost coin flipped (1-based) and the number of coins flipped. If there are several initial moves with which Alice wins the game, you can print any of them. If Alice cannot win the game, just print "NO" for that test case.

제한

예제 입력 1

3
TTTT
HTHT
HTTH

예제 출력 1

NO
NO
YES 4 2

힌트

출처

Contest > Calgary Collegiate Programming Contest > CCPC 2013 C번

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

출처

대학교 대회

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

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