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

9688번 - Marbles 다국어

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

문제

Byteted and Bited decided to play marbles. There is an ever number of marbles in the urn. Each marble has been marked by exactly one digit. The rules of the game are very simple: the players take on random one marble each from the urn in turns. The game ends when the urn is empty. The player who has accumulated a set of marbles with a larger product of digits, wins.

The boys very much got to like this game. They are both very ambitious and they really like to win, so a draw makes nobody happy. Byteted and Bited are determined to avoid such an ending situation at all costs. Write a program which will check if for a given initial set of marbles in the urn, the game can end up drawn.

입력

The first line of input contains one integer t (1 ≤ t ≤ 1000), indicating the number of test cases to be considered.

Each of the following t lines contains ten non-negative integers k0, k1, ..., k9 (0 ≤ ki ≤ 1015), where ki indicates the number of marbles marked with i digit. The sum of the numbers ki is even and positive in each test case.

출력

Your program should produce t lines containing answers to respective test cases. The result for each test case that can end with a draw is word TAK (Polish for yes). In the opposite case the result should be NIE (Polish for no).

제한

예제 입력 1

5
0 1 0 1 1 4 1 0 5 1
0 1 1 0 3 0 0 0 0 3
1 1 0 4 0 0 2 0 0 2
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000
0 999999 999999 1000000 1000000 1000000 1000000 1000000 1000000 1000000

예제 출력 1

TAK
NIE
NIE
TAK
NIE

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > Poland Collegiate Programming Contest > AMPPZ 2013 G번

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

출처

대학교 대회

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

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