Amit and Nitin
Amit and Nitin are very good friends. Amit gives Nitin a simple problem to solve. Since Nitin is not very good at coding, help him solve the problem.
There are some special numbers where the ith special number is represented as:
Si=Si-1 + 3*Si-2 when i%2 = 1
Si=Si-1 + 7 when i%2 = 0
Thus some initial special numbers are 2,7,13,20...
Now Nitin has to answer for any given number N whether it is a Super number or not. A Super number is a number that can be represented as sum of unique special numbers. For example, 9(2+7) is a Super number whereas 11 is not a Super number.
The first line of input contains T, denoting the number of test cases. Next T lines will contain N as described above.
For each test case, answer "YES" if number N is Super number else answer "NO" in a new line.
- 1 ≤ T ≤ 5
- 1 ≤ N ≤ 10^10
SubtasksSubtask #1 (20 points), Time limit : 1 sec
1 ≤ T ≤ 5, 1 ≤ N ≤ 10^5
Subtask #2 (80 points), Time limit : 1 sec
Input: 2 9 11 Output: YES NO
In the sample input 1:
for test case 1, 9 can be formed by sum of 7 and 2.
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, CLOJ, FS|
Fetching successful submissions