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.
The first line contains T - the number of test cases. The next T lines contain a number n.
For each test case, print "Win" if A can win the game, or else print "Lose", separated by new line.
Corner case: n=0Last edit: 2019-12-14 21:18:00
@Y17prashant I really didnt know before hand
Precomputation ^_^ ....Well same problem already exist on spojLast edit: 2019-11-11 23:33:38
@nam_cs can you consider the number of test cases too into your complexity. You'll get why it's giving a TLELast edit: 2019-11-05 15:54:11
O(n*root(n)) giving TLE