Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
86774 | 丁俊杰 | 猜数字 | Python3 | Accepted | 165 MS | 3784 KB | 613 | 2024-07-27 23:19:01 |
n=int(input()) results=[] for _ in range(n): a,b,c=map(int,input().split()) x=1000 flag=False while x<=9999: if x%a==0 and (x+1)%b==0 and (x+2)%c==0: flag=True break x+=1 #当找到符合条件的x值后,会立即通过 break 语句跳出当前的 while 循环。 #因此,一旦 found 被设置为 True,while 循环中的x+=1将不再执行。 if flag: results.append(x) else: results.append("Impossible") for result in results: print(result) #第1种方法for循环和while循环结合