python 2错误:输入时RTE

时间:2014-01-03 17:26:57

标签: python

这是我的代码:

t=int(raw_input())

for i in range(t):


    l,d,s,c = map(int,raw_input().split())
    counter = 0
    for j in range(d):
        if(s>=l):
            counter=counter+1
            break
        else:
            s = s +(s*c)
    if(counter>0):
        print("h")
    else:
        print("k")

错误:第1行,读取行时的EOF

该程序在PyScriptor IDE上运行良好,但RTE显示在ideone /在线判断

1 个答案:

答案 0 :(得分:1)

This SO post might be helpful

看起来IDEone无法按顺序执行多个raw_input()调用,并且您在此脚本中进行了两次调用。这样可以正常工作:

t=int(raw_input())

for i in range(t):


    l,d,s,c = map(int,"1 2 3 4".split())
    counter = 0
    for j in range(d):
        if(s>=l):
            counter=counter+1
            break
        else:
            s = s +(s*c)
    if(counter>0):
        print("h")
    else:
        print("k")