結果
問題 |
No.3186 Big Order
|
ユーザー |
|
提出日時 | 2025-06-20 22:14:47 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 476 bytes |
コンパイル時間 | 405 ms |
コンパイル使用メモリ | 82,016 KB |
実行使用メモリ | 209,064 KB |
最終ジャッジ日時 | 2025-06-20 22:15:01 |
合計ジャッジ時間 | 3,814 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | TLE * 1 -- * 33 |
ソースコード
import math def calc(A, B, C): if B == 0: return 0, 1 x, y = calc(A, B // 2, C) x += x if x >= 998244353: x -= 998244353 y = y * y if B % 2 == 1: y *= A while y % C == 0: y //= C x += 1 if x >= 998244353: x -= 998244353 return x, y def solve(): A, B, C = map(int, input().split()) ans = 0 while A % C == 0: A //= C ans += B A = math.gcd(A, C) x, y = calc(A, B, C) ans += x ans %= 998244353 print(ans) T = int(input()) for _ in range(T): solve()