Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def lastStanding(n):
- start = 1
- d = 2
- end = n
- while True:
- if (end - start) % d == 0:
- start += d
- else:
- end = end - (d / 2)
- print start, end, d
- d *= 2
- if start == end:
- print 'Done: %d' % start
- break
- if start + d > end:
- print 'Done: %d' % start
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement