結果

問題 No.3186 Big Order
ユーザー kotatsugame
提出日時 2025-06-20 21:43:51
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 250 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 8,192 KB
実行使用メモリ 13,184 KB
最終ジャッジ日時 2025-06-20 21:44:07
合計ジャッジ時間 7,494 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11 WA * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

gets.to_i.times{
  a,b,c=gets.split.map &:to_i
  t=[]
  x=1
  300.times{
    x*=a
    t<<0
    while x%c==0
      x/=c
      t[-1]+=1
    end
    x=x.gcd(c)
  }
  l=(1..).find{|l|t[...l]==t[l...l+l]}
  puts (b/l*t[...l].sum+t[...b%l].sum)%998244353
}
0