這段代碼哪裡錯了?
def solve(a,g):
if sum(a)>sum(g):
return(Yes)
if sum(a)<=sum(g):
return(No)
try:
while True:
M,N=map(int,input().split())
a, b = map(int, input().split())
if M<N:
print('No')
if M>N:
ants=list(map(int(),input().split()))
grasshoppers=list(map(int(),input().split()))
print(solve(ants,grasshoppers))
except EOFError:
pass
謝謝
2021-4-20
感謝AndyChiang提醒,已將網址補上
連結在此: https://zerojudge.tw/ShowProblem?problemid=f708
ants = []
grasshoppers = []
try:
ants = [int(i) for i in input().split(",")]
grasshoppers = [int(i) for i in input().split(",")]
except:
print("format error")
raise
if len(ants)>len(grasshoppers) and sum(ants) > sum(grasshoppers):
print("Ants, go to fight!!!")
else:
print("Ants are chicken")
至少把題目內容和要做什麼放上來吧...
只貼程式碼上來我要怎麼知道哪裡錯...
可以講一下你這段code想要完成的事情