結果

問題 No.3186 Big Order
ユーザー GGanari
提出日時 2025-07-06 23:31:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 399 bytes
コンパイル時間 405 ms
コンパイル使用メモリ 82,268 KB
実行使用メモリ 76,024 KB
最終ジャッジ日時 2025-07-06 23:31:27
合計ジャッジ時間 7,281 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
t = int(input())
mx = 140
for _ in range(t):
    a,b,c = map(int,input().split())
    l = [0] * mx
    
    A = a
    for i in range(1,mx):
        l[i] = l[i-1]
        while(A % c == 0):
            A//=c
            l[i]+=1
        A*=a
    
    p = 1
    for i in range(mx):
        if(l[i]*p > l[p]*i):
            p = i
    
    print(l[p]*b//p%998244353)
0