狀況
#0: 50% AC (16ms, 4.6MB)
通過檢測
#1: 50% WA (line:1)
您共輸出 0 行。
對於如何造成的,毫無頭緒 QQ
附上我的原始碼
# a738: 最大公约数 from sys import stdin def isNum(s): try: int(s) return True except ValueError: return False def GCD(a, b): while b != 0: r = a % b a = b b = r return a data = [] buf = [] try: while True: while len(data) != 2: # 至少要有兩個數字才能算 if len(buf) == 0: line = input().strip('\n') buf = buf + line.split(' ') if len(buf[0]) > 0 and isNum(buf[0]): data.append(int(buf[0])) buf = buf[1:] print(GCD(data[0], data[1])) # 清掉剛剛計算的兩個數字 data = data[2:] except EOFError: pass
狀況
#0: 50% AC (16ms, 4.6MB)
通過檢測
#1: 50% WA (line:1)
您共輸出 0 行。
對於如何造成的,毫無頭緒 QQ
附上我的原始碼
# a738: 最大公约数 from sys import stdin def isNum(s): try: int(s) return True except ValueError: return False def GCD(a, b): while b != 0: r = a % b a = b b = r return a data = [] buf = [] try: while True: while len(data) != 2: # 至少要有兩個數字才能算 if len(buf) == 0: line = input().strip('\n') buf = buf + line.split(' ') if len(buf[0]) > 0 and isNum(buf[0]): data.append(int(buf[0])) buf = buf[1:] print(GCD(data[0], data[1])) # 清掉剛剛計算的兩個數字 data = data[2:] except EOFError: pass
測資的某行,好像是用 tab 來分隔的。