真搞不懂哪裡寫錯了
c=0
while True:
try:
c+=1
print(f'Case #{c} :')
n,m=list(map(int,input().split()))
a=[]
for i in range(n):
a.append(list(map(int,input().split())))
for i in range(1,m):
a[0][i]=a[0][i]+a[0][i-1]
for i in range(1,n):
a[i][0]=a[i][0]+a[i-1][0]
for j in range(1,n):
for i in range(1,m):
a[j][i]=min([a[j-1][i]+a[j][i],a[j][i-1]+a[j][i]])
print(min([a[n-1][m-2],a[n-2][m-1]]))
except EOFError:
break
在測試執行時多輸出了"Case #3 :",然後送出後則是多了"Case #31 :"及"Case #901 :"