結果

問題 No.2128 Round up!!
ユーザー ニックネームニックネーム
提出日時 2022-11-18 22:56:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 347 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 11,768 KB
実行使用メモリ 10,172 KB
最終ジャッジ日時 2023-10-20 07:55:35
合計ジャッジ時間 6,525 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
10,156 KB
testcase_01 AC 347 ms
10,172 KB
testcase_02 WA -
testcase_03 AC 392 ms
10,172 KB
testcase_04 AC 400 ms
10,172 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 380 ms
10,172 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0