daily pastebin goal
64%
SHARE
TWEET

Untitled

a guest Mar 24th, 2019 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2.  
  3.  
  4. def main(argv=None):
  5.     if argv is None:
  6.         argv = sys.argv
  7.  
  8.     gamma_code = str(argv[1])
  9.  
  10.     N = gamma_code.index('1')
  11.     M = int(gamma_code[-N:], 2)
  12.  
  13.     print(2**N + M)
  14.     return 0
  15.  
  16.  
  17. if __name__ == "__main__":
  18.     sys.exit(main(sys.argv))
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