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
chandan dwivedi:
2016-05-30 13:13:21
space after : cost me 3 wa :( |
|
Abishek:
2016-04-28 18:17:11
WA with C++ 14. AC with C++ 4.3.2 . |
|
fly_sky12:
2016-03-11 21:05:02
i think sqrt function is giving problem in this.
|
|
minhthai:
2016-01-30 11:08:00
O(1) is possible :) Also, don't trust the sqrt function |
|
dwij28:
2015-12-30 18:28:40
Wikipedia is your friend for this question. |
|
iharsh234:
2015-12-24 12:23:20
b = sqrt(N)
|
|
Siddharth Singh:
2015-12-02 14:25:59
I Had The Same Prob Dushyant :)
|
|
Dushyant Singh:
2015-11-23 10:21:13
Finally i got it why it gave WA in C, C++ 14 and AC in C++ 4.3. It's because range of N is as large as 10^18 so sqrt() function is not accurate for large values instead use sqrtl(). And as others are using (root-1) and (root+1), that's for precision too. You can ignore that if you are using sqrtl() function. |
|
sy_117:
2015-08-14 13:04:40
Can anybody tell me why r we checking for (root-1) & (root+1)????? |
|
shubham sinha:
2015-08-09 15:33:38
for c++ user use c++ 4.3.2 use scanf and printf |
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 |