Advertisement
Guest User

Untitled

a guest
Dec 8th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. !/usr/bin/env python
  2. def rangeConsecutiveXor(l, r):
  3. sum=0
  4. while(r>=l):
  5. sum^=f(r)
  6. r-=1
  7. print sum
  8.  
  9.  
  10. def f(a):
  11. res = [a,1,a+1,0]
  12. return res[a%4]
  13.  
  14.  
  15. rangeConsecutiveXor(1,5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement