HackerRank "Vertical Rooks"

Please note: VROOK cannot go back-ward - that leads to a simple variation to Game of Nim: just XOR.

t = int(input())
for _ in range(t):
n = int(input())
# Get input
p1 = []
for _ in range(n): p1.append(int(input()))
p2 = []
for _ in range(n): p2.append(int(input()))
# Game of Nim
nim = 0
for i in range(n):
nim ^= abs(p2[i]- p1[i]) - 1
print ("player-2" if nim != 0 else "player-1")
上一篇:5月23日笔记-js绑定事件、解绑事件、复合事件


下一篇:iOS即时通讯之CocoaAsyncSocket源码解析四