結果

問題 No.3186 Big Order
ユーザー koba-e964
提出日時 2025-06-29 17:16:26
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 535 bytes
コンパイル時間 457 ms
コンパイル使用メモリ 82,516 KB
実行使用メモリ 84,004 KB
最終ジャッジ日時 2025-06-29 17:16:30
合計ジャッジ時間 4,160 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other TLE * 1 -- * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

# https://yukicoder.me/problems/no/3186
# The author read the solution before implementing this.


t = int(readline())
for _ in range(t):
    a, b, c = map(int, readline().split())
    opt_num, opt_den = 0, 1
    for m in range(1, 133):
        x = 0
        r = a ** m
        while r % c == 0:
            r //= c
            x += 1
        if opt_num * m < x * opt_den:
            opt_num, opt_den = x, m
    print(opt_num * b // opt_den % 998244353)
0