我在codechef上解决了一个问题,并成功地测试了我的python代码。由于某种原因,它说的Runtime error NZEC
是“非零错误代码”。
我的代码:
N, M = input().split(" ")
N = int(N)
M = int(M)
if (N % 5 == 0 and not N > M):
print (M - N - 0.50)
else:
print (M)
您的代码是正确的,几乎只需要更改一行即可。
N, M = input().split(" ")
N = int(N)
# The line below has been changed because M when given at stdin is a
# float value and during split it is converted to string. But a string
# with decimal can't be converted directly to int, so, it needs to be
# converted to float
M = float(M)
if (N % 5 == 0 and not N > M):
print (M - N - 0.50)
else:
print (M)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句