結果

問題 No.3186 Big Order
ユーザー miztom
提出日時 2025-06-20 21:56:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 449 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 77,944 KB
最終ジャッジ日時 2025-06-20 21:56:40
合計ジャッジ時間 4,818 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

exec("def gcd(a,b):\n if not a:return b\n"+" if not(b:=b%a):return a\n if not(a:=a%b):return b\n"*300+" return gcd(a,b)")
for i in range(int(input())):
    a,b,c=map(int,input().split())
    r=0
    while a%c<1:a//=c;r+=1
    r*=b;x=gcd(a,c)
    X=0;a=1
    while b:
        if b&1:
            r+=X
            a=gcd(a*x,c)
            if a==c:r+=1;a=1
        X+=X
        x=gcd(x*x,c)
        if x==c:x=1;X+=1
        b>>=1
    print(r%998244353)
0