Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  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))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement