파이썬 eoferror?가 뭔가요?
조회수 10354회
def max_sum(A, left, right):
if left == right-1:
return A[left]
else:
m=(left + right)//2
left_max=max_sum(A,left,m)
right_max=max_sum(A,m,right)
cross_max=max_cross(A,left,m,right)
if(left_max > right_max and left_max > cross_max):
return left_max
elif(right_max > left_max and right_max> cross_max):
return right_max
else:
return cross_max
def max_cross(A, left, m, right):
cross_left= float('-inf')
cross_temp= 0
cross_begin=m
for i in range(m -1, left -1, -1):
cross_temp - cross_temp + A[i]
if cross_temp>cross_left:
cross_left = cross_temp
cross_begin = i
cross_right= float('-inf')
cross_temp=0
cross_finish=m+1
for i in range(m, right):
cross_temp = cross_temp + A[i]
if cross_temp>cross_right:
cross_right = cross_temp
cross_finish = i +1
return cross_begin, cross_finish, cross_left+cross_right
# A[left], ..., A[right-1] 중 최대 구간 합 리턴
A = input('Enter the list of numbers: ')
A = [int(x) for x in input().split()]
sol = max_sum(A, 0, len(A))
print(sol)
제 코딩을 이렇게 했는데
Traceback (most recent call last):
File "/solution.py", line 39, in <module>
A = input('Enter the list of numbers: ')
EOFError: EOF when reading a line
이런 오류가 뜨네요 이게 무슨 의민가요
-
(•́ ✖ •̀)
알 수 없는 사용자
댓글 입력