You are viewing a single comment's thread. Return to all comments →
If you know Zeckendorf representation it's kind of trivial. Python3
def solve(a): fib = [1,2] for _ in range(100): fib.append(fib[-2]+fib[-1]) def zeck(n): # Zeckendorf representation if n > fib[-1]: raise ValueError('Out of range') ret = '' for f in reversed(fib): if n >= f: ret += '1' n -= f else: ret += '0' return ret.lstrip('0') ret = 0 for _ in a: ret ^= int(zeck(_),2) return ret % (10**9+7)
Seems like cookies are disabled on this browser, please enable them to open this website
Chandrima and XOR
You are viewing a single comment's thread. Return to all comments →
If you know Zeckendorf representation it's kind of trivial.
Python3