#45467: 教教我為什麼錯了


mocha880ft@gmail.com (羅竑硯)

學校 : 不指定學校
編號 : 301338
來源 : [61.230.25.138]
最後登入時間 :
2025-03-29 09:26:10
a215. 明明愛數數 | From: [61.230.48.1] | 發表日期 : 2025-03-05 21:21

為甚麼我檢測是錯了

while True:
    try:
        n,m=map(int,input().split())
        day=0
        total=0
        while total<m:
            total+=n
            n+=1
            day+=1
        print(day)
    except EOFError:
        break
 
#45468: Re: 教教我為什麼錯了


sam851015@gmail.com (多挖鼻孔有益身心健康)

學校 : 臺中市立惠文高級中學
編號 : 277705
來源 : [123.192.228.253]
最後登入時間 :
2025-03-11 12:39:29
a215. 明明愛數數 | From: [123.192.228.253] | 發表日期 : 2025-03-05 22:11

為甚麼我檢測是錯了

while True:
    try:
        n,m=map(int,input().split())
        day=0
        total=0
        while total
            total+=n
            n+=1
            day+=1
        print(day)
    except EOFError:
        break


n, m 有可能是負數

 

 

 
ZeroJudge Forum