Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- !/usr/bin/env python
- def rangeConsecutiveXor(l, r):
- sum=0
- while(r>=l):
- sum^=f(r)
- r-=1
- print sum
- def f(a):
- res = [a,1,a+1,0]
- return res[a%4]
- rangeConsecutiveXor(1,5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement