int((n + 1)/ 2)和(n + 1)// 2之间的区别是什么?

In python for a problem https://www.spoj.com/problems/APM i used

t = int(input())
while t > 0:
    n= int(input())

    if n%2 == 0:
        print(-1)
    else:
        n = int((n+1)/2)
        print(n,n-1)
    t -= 1 

此代码并被拒绝,

但是为此:

t = int(input())

while t > 0:
    n= int(input())

    if n%2 == 0:
        print(-1)
    else:
        n = (n+1)//2
        print(n,n-1)
    t -= 1  

接受,我的问题是为什么int((n + 1)/ 2)在n <10 ^ 18时给出的ans不同于(n + 1)// 2?

评论