this code gets WA in python 3 but AC in python 2
for i in range(10):
both = int(input())
k = int(input())
n = int((both - k)/2)
print(n + k)
print(n)
created
last reply
- 1
reply
- 570
views
- 2
users
- 2
links
this code gets WA in python 3 but AC in python 2
for i in range(10):
both = int(input())
k = int(input())
n = int((both - k)/2)
print(n + k)
print(n)
Try this in Python 3:
both = int(“10000000000000000000000000000000000000000000000000000000”)
k = 5
n = int((both - k)/2)
print(n + k)
print(n)
n = int((both - k)//2)
print(n + k)
print(n)
Then take a look here1 for an explanation.
Even if this were a bug, are you expecting SPOJ to fix Python?
Topic | Category | Replies | Views | Activity |
---|---|---|---|---|
PALIN - wrong answer | Online Judge System | 1 | 142 | Mar 23 |
Next Palindrome exception | Online Judge System | 1 | 115 | Mar 26 |
Username Invalid problem | Online Judge System | 0 | 103 | Apr 14 |