Submit | All submissions | Best solutions | Back to list |
CBIT01 - Game of Square |
A and B are playing a game. They are given a number N. They make moves in turn, A playing first. Each move consists of subtracting a perfect square (not less than 1) from the number, the player who faces 0 loses. You are given a number N, you have to find out whether A can win the game, if both A and B play optimally.
Input
The first line contains T - the number of test cases. The next T lines contain a number n.
Output
For each test case, print "Win" if A can win the game, or else print "Lose", separated by new line.
Constraints
1 ≤ T; N ≤ 105
Example
Input: 5 1 2 3 1 10 Output: Win Lose Win Win Lose
Added by: | Valiveti |
Date: | 2019-11-03 |
Time limit: | 0.100s-1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | Internal Contest |
hide comments
2020-08-31 11:26:07 Pranay
https://www.spoj.com/problems/VECTAR11 |
|
2019-12-14 20:58:21
Corner case: n=0 Last edit: 2019-12-14 21:18:00 |
|
2019-11-13 03:52:17
@Y17prashant I really didnt know before hand |
|
2019-11-11 23:30:35
Precomputation ^_^ ....Well same problem already exist on spoj Last edit: 2019-11-11 23:33:38 |
|
2019-11-05 15:52:41
@nam_cs can you consider the number of test cases too into your complexity. You'll get why it's giving a TLE Last edit: 2019-11-05 15:54:11 |
|
2019-11-05 15:29:05
O(n*root(n)) giving TLE |
|
2019-11-04 11:46:35
Nice problem =@valiveti=> @srisai1912 Thanks Last edit: 2019-11-05 15:54:35 |