OverflowError: integer division result too large for a float

n,m = map(int,input().split())
l=m+n-1
a=1
b=1
for i in range(l,m,-1):
    a*=i
for j in range(1,n):
    b*=j
print(a)
print(b)
res = int(a/b)
print(res%1000000007)

Traceback (most recent call last):

    res = int(a/b)
OverflowError: integer division result too large for a float

在Python3中,a/b返回的是float类型,float最大值如下

如果绕过这个类型,请用//代替/,这样返回的是Integer

>>> import sys
>>> sys.float_info.max
1.7976931348623157e+308

你可能感兴趣的:(python,image)