sys方法 vs input()方法
輸出結果都正確請問為甚麼第一個方法錯誤
from math import gcd from sys import stdin for s in stdin: a,b=map(int,s.split()) print(gcd(a,b))
-------------------------------------------------------
import math while True: try: x, y = [int(i) for i in input().split()] print(math.gcd(x, y)) except: break
sys方法 vs input()方法
輸出結果都正確請問為甚麼第一個方法錯誤
from math import gcd from sys import stdin for s in stdin: a,b=map(int,s.split()) print(gcd(a,b))
-------------------------------------------------------import math while True: try: x, y = [int(i) for i in input().split()] print(math.gcd(x, y)) except: break
抱歉第二個應該是
import math while True: try: x, y = [int(i) for i in input().split()] print(math.gcd(x, y)) except: break