You are viewing a single comment's thread. Return to all comments →
python 2 solution
def oddprimefactor(n): c = 0 if n % 2 == 0: c += 1 while n % 2 == 0: n /= 2 i = 3 while i * i <= n: while n % i == 0: n /= i if i % 2 != 0: c += 1 i += 1 if n > 2: c += 1 return c for _ in range(int(raw_input())): n = int(raw_input()) towers = map(int, raw_input().split()) ans = map(oddprimefactor, towers) x = 0 for i in ans: x ^= i print 2 if x == 0 else 1
Seems like cookies are disabled on this browser, please enable them to open this website
Tower Breakers, Again!
You are viewing a single comment's thread. Return to all comments →
python 2 solution