Skip to content

Instantly share code, notes, and snippets.

@saikatkumardey
Created February 19, 2015 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saikatkumardey/092d2552e5f861315c49 to your computer and use it in GitHub Desktop.
Save saikatkumardey/092d2552e5f861315c49 to your computer and use it in GitHub Desktop.
Double Cola
#!/usr/bin/env python
import math
n = input()
ans=["","Sheldon", "Leonard", "Penny", "Rajesh", "Howard"]
i= int(math.log(math.ceil(n*1.0/5),2))
ans_index= int(math.ceil((n-(2**i -1)*5 )/(2**i*1.0)))
print ans[ans_index]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment