|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||512 MB||2||2||2||100.000%|
International Mathematical Olympiad (IMO) 2016 was held on 11th – 12th July. There are 3 problems in each day and one of them is as follows.
Problem 2. Find all positive integers n for which each cell of an n × n table can be filled with one of the letters I, M and O in such a way that:
Note: The rows and columns of an n × n table are each labelled 1 to n in a natural order. Thus each cell corresponds to a pair of positive integers (i,j) with 1 ≤ i, j ≤ n. For n > 1, the table has 4n-2 diagonals of two types. A diagonal of the first type consists of all cells (i,j) for which i+ j is a constant, and a diagonal of the second type consists of all cells ( i,j) for which i-j is a constant.
The answer of this question is all positive integers which is divisible by 9 ( n = 9k for some positive integer k). However, you are now participating ACM-ICPC contest, not IMO, so the question is changed to “Determine whether the given positive integer x can be used as n in the given problem?”
The first line contains the number of test cases T (1 ≤ T ≤ 1000)
For each test case, there will be an integer x (1 ≤ x ≤ 10100 000)
For each test case, print ‘YES’ if x can be used as n, and ‘NO’otherwise, both without quote.
3 1 81 999999999999999999999999999999
NO YES YES