結果
問題 |
No.3186 Big Order
|
ユーザー |
|
提出日時 | 2025-06-20 22:18:56 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 550 bytes |
コンパイル時間 | 288 ms |
コンパイル使用メモリ | 82,236 KB |
実行使用メモリ | 236,184 KB |
最終ジャッジ日時 | 2025-06-20 22:19:17 |
合計ジャッジ時間 | 3,756 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | TLE * 1 -- * 33 |
ソースコード
import math mod=998244353 def solve(): a,b,c=map(int,input().split()) if (a**200)%c!=0: print(0) return res=1 ans=0 while b>0 and a!=1: a_tmp=a d=1 while a_tmp%c!=0 and d<b: a_tmp*=a d+=1 if a_tmp%c!=0: res*=a_tmp break res*=a**(b%d) while res%c==0: res//=c ans+=1 b//=d cnt=0 while a_tmp%c==0: cnt+=1 a_tmp//=c ans=(ans+b*cnt)%mod a=a_tmp while res%c==0: res//=c ans+=1 print(ans) t=int(input()) for _ in range(t): solve()