TIPTOP - Tip Top Game


Alim and Sufian are two good friends. They love playing a game with numbers, and recently, they discovered a new game called “Tip Top”. The rule of the game is they took a number (N) randomly, after that they find all divisors of N. Then they starting to play the game first Alim took a divisor, then Sufian so on. The person who took the last divisor will win the game.

Every time the game started with Alim. Now Alim wants to know when he will win.

As you a good programmer your task is to find will Alim win or not.

Input

Input starts with an integer T (T ≤ 105), denoting the number of test cases. Each case starts with a line containing an integer N (1 ≤ N ≤ 1018) the number.

Output

For each case you have to print “Yes” if Alim will win otherwise “No” with case number. See the sample for exact formatting.

Sample

Input:
2
4
5

Output:
Case 1: Yes
Case 2: No

Problem setter: Ajharul Islam Barid, Dept. of CSE

Bangladesh University of Business and Technology (BUBT)


hide comments
thichankitkat: 2022-01-29 06:57:22

unable to solve by Python3, too slow, use Py2 instead

abhishekv18: 2019-11-06 13:37:14

No need to calculate all the divisor!!
think clever :)

kshubham02: 2019-08-19 19:27:00

[EDITED with answers]

Could someone clarify the statement please?
1. What does 'taking' a divisor mean? --- consider it as removing it from the list of divisors.
2. Do 'divisor's include 1 and the number itself as well? --- yes.
3. Are they playing optimally? (I hope so) --- This isn't a dp question. There is only one way to play - choose any divisor and remove it from the list.

Last edit: 2019-08-21 20:25:32
stormborn_: 2019-02-26 21:05:31

take :-> unsigned long long s=sqrt(n);
it won't accept integer value

prabhav_123: 2019-01-03 10:10:39

long long,space,\n costed me 3 WA -_-

aayu97: 2018-11-17 09:05:05

WA in 4.3.2 and AC in 14. why so?

gaurav1614: 2018-08-25 07:41:02

if(sqrt(n)==floor(sqrt(n))) gives wrong ans.
but
x=sqrt(n)
if(x*x == n) gets accepted.

dynamo214: 2018-08-25 07:16:58

Use sqrtl() for large integers square root.

y17prashant: 2017-12-30 10:12:19

same as sinha and eggs.......

nadstratosfer: 2017-09-16 00:50:32

Interesting problem to tackle. Would have been a very frustrating, non-learning experience if I didn't turn to comments.

345678 -> No

Last edit: 2017-09-16 00:52:18

Added by:Shipu Ahamed
Date:2013-09-18
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64