結果
| 問題 |
No.2128 Round up!!
|
| コンテスト | |
| ユーザー |
ニックネーム
|
| 提出日時 | 2022-11-18 22:52:32 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 346 bytes |
| コンパイル時間 | 145 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-09-20 03:21:29 |
| 合計ジャッジ時間 | 6,533 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 12 |
ソースコード
from math import gcd
for _ in range(int(input())):
x, a, b = map(int, input().split())
if a == b: print((x%a!=0)+1); continue
if a > b: a, b = b, a
m = a*b//gcd(a, b)
n = (x-1+m)//m*m
c = (x-1+a)//a*a
d = (x-1+b)//b*b
if x == d: ans = 1
elif x == c or d < c: ans = 2
else: ans = 3
print(ans+(n-d)//b*2)
ニックネーム