Advertisement
korol

Untitled

Aug 13th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. from sys import *
  2. setrecursionlimit(100000000)
  3. f = {0: 1}
  4. def fact(n):
  5. global f
  6. if not n in f:
  7. f[n] = n * fact(n - 1)
  8. return f[n]
  9. def c(m, n):
  10. return fact(n) // (fact(n - m)*fact(m))
  11. def light(n):
  12. ans = 1
  13. for i in range(1, n):
  14. ans += c(i, n)
  15. return ans
  16. for _ in range(int(input())):
  17. print(light(int(input())))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement