이전 정답에서 몇줄 수정한 경우에도 RTE (nonzero return code) 발생하여 , 원인 몰라 헤메고 있네요..
pycharm 이나 python 2.7 IDLE 에서는 에러 없는데....
import sys
def fx2(day, team, cost_ls):
if team == 1 :
return min(cost_ls)
min_cost_list = [] # for result
loop_cnt = day - team + 1
tmp_sum = []
k = sum(cost_ls[0:team])
for i in xrange(len(cost_ls) - team):
k = k - cost_ls[i] + cost_ls[i+team]
tmp_sum.append(k)
min_cost_list.append(min(tmp_sum)/float(team))
team += 1
loop_cnt -= 1
for loop in xrange(loop_cnt,0,-1):
tmp_sum2 = [ tmp_sum[i] + cost_ls[team+i-1] for i in xrange(loop) ]
tmp_sum = tmp_sum2
min_cost_list.append(min(tmp_sum)/float(team))
team += 1
return min(min_cost_list)
def main():
test_count = sys.stdin.readline()
test_count = int(test_count)
day_team_ls = []
cost2 =[]
for i in xrange(test_count):
day_team = sys.stdin.readline()
cost = sys.stdin.readline()
day_team_ls.append(day_team)
cost2.append(cost)
for i in xrange(test_count):
day, team = day_team_ls[i].split()
day = int(day)
team = int(team)
cost = [int(x) for x in cost2[i].split()]
print fx2(day, team, cost)
if __name__ == '__main__':
main()
11년 전
0개의 댓글이 있습니다.
정회원 권한이 있어야 커멘트를 다실 수 있습니다. 정회원이 되시려면
온라인 저지에서 5문제 이상을 푸시고, 가입 후 7일 이상이 지나셔야
합니다. 현재 문제를 푸셨습니다.
jayu108
python 에서 RTE (nonzero return code) 발생이유를 모르겠네요..
이전 정답에서 몇줄 수정한 경우에도 RTE (nonzero return code) 발생하여 , 원인 몰라 헤메고 있네요..
pycharm 이나 python 2.7 IDLE 에서는 에러 없는데....
11년 전