SHARE
TWEET

Python Joshepus Problem

naeem043 Oct 10th, 2018 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = int(input('Enter the number of people: '))
  2. p = 0
  3. for i in range(1,n+1):
  4.     k = pow(2,i)
  5.     if k<= n:
  6.         p += 1  
  7. l = n-pow(2,(p))
  8.          
  9. print("Last survive people: "+str(2*l+1))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top