Codechef问题解决方案中python中的EOF错误

时间:2019-08-04 04:17:04

标签: python ide pycharm

我在代码厨师上编写了一个有问题的代码,该代码在我的PYCHARM ide上运行,并且当我在代码厨师ide中使用自定义输入但提交后会出现编译错误。

def win(n):
    goals=list(map(int,input().split()))
    fouls=list(map(int,input().split()))
    goal=[i*20 for i in goals]
    foul=[j*(-10) for j in fouls]
    for i in range(len(goals)):
        p=goal[i]+foul[i]
        if p<0:
            p==0
            points.append(p)
        else:
            points.append(p)
    return max(points)


t=int(input())
for i in range(t):
    k=int(input())
    x=win(k)
    print(x)

Traceback (most recent call last):
  File "./prog.py", line 16, in <module>
EOFError: EOF when reading a line

1 个答案:

答案 0 :(得分:0)

代码中有一些错误...

def win(n):
goals=list(map(int,input().split()))
fouls=list(map(int,input().split()))
goal=[i*20 for i in goals]
foul=[j*(-10) for j in fouls]
points=[]
for i in range(len(goals)):
    p=goal[i]+foul[i]
    if p<0:
        p=0
        points.append(p)
    else:
        points.append(p)
return max(points)


t=int(input())
for i in range(t):
    k=int(input())
    x=win(k)
    print(x)