Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- # f(n)=binom(binpow(2,n,m)-2,binpow(2,n-1,m)-1,m)*f(n-1)^2
- m = int(1e9+7)
- def binpow(x,y,z):
- if (y==0):
- return 1%z
- res = binpow(x,y//2,z)
- res = ((res%z)*(res%z))%z
- if (y%2):
- res = (res*x)%z
- return res
- def binom(x,y,z):
- ans = math.factorial(x)//(math.factorial(y)*math.factorial(x-y))
- return ans%z
- ans = 1
- ans = (ans*binpow(80,8,m))%m
- print(ans)
- ans = (ans*binpow(binom(14,7,m),4,m))%m
- print(ans)
- ans = (ans*binpow(binom(30,15,m),2,m))%m
- print(ans)
- ans = (ans*binom(62,31,m))%m
- print(ans)
- # print(binom(4,2,m))
- # print(binom(8,2,m))
- # print(binom(6,3,m))
- # print(binom(5,2,m))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement