結果

問題 No.2128 Round up!!
ユーザー otoshigootoshigo
提出日時 2022-11-19 15:35:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 338 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 11,884 KB
実行使用メモリ 10,292 KB
最終ジャッジ日時 2023-10-20 20:02:55
合計ジャッジ時間 5,878 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import math
def f(p,q,r,l):
    return p//q+p//r-p//l

t=int(input())
for _ in range(t):
    x,a,b=map(int,input().split())
    if a<b:
        a,b=b,a
    l=a*b//math.gcd(a,b)
    y=((x+l-1)//l)*l
    ans=2*(y//a-(x-1)//a)-1
    z=(x+a-1)//a
    if x%b>=z%b:
        ans+=1
    if x%a>0 and x%b>0:
        ans+=1
    print(ans%998244353)
0