python - 即使使用正确的语法和正确的 poutput,python 3.0 中的 eof
问题描述
我正在使用正确的输入语句并为代码提供正确的输入,然后它也给出了 NZEC 错误。请任何人也可以帮助使用 python 3
def fun():
T=int(input())
for i in range(T):
H,P=map(int,input().split())
while (H > P):
H = H - P
P = P / 2
if (H == 0):
print(1)
break
elif (P == 0):
print(0)
break
if (H < P):
print(1)
# H = 0
# P = 0
fun()
解决方案
尝试更改H,P=map(int,input().split())
为H,P=map(int,input().strip().split())
推荐阅读
- node.js - 在 React Native 中存储密钥的最安全方式是什么
- laravel - Vue:在它自己的 Github 仓库中有前端?
- javascript - 必须包含小数点的数字的正则表达式
- haskell - 保存超出控制结构的值
- android - 无法在 MAC OS 中的 Apache Cordova 中为 Android SDK 在 WebStorm 中设置 PATH
- python - Spotipy 音频功能返回类型错误
- r - R错误地计算了数据框中两个单元格的平均值
- sitecore - Sitecore 在此处添加按钮未显示“添加渲染”对话框
- rust - 如何从 Rust 的内存缓冲区执行原始指令?
- java - 计算数字的位数总和时数组溢出