結果

問題 No.3186 Big Order
ユーザー kotatsugame
提出日時 2025-06-20 21:44:51
言語 Ruby
(3.4.1)
結果
AC  
実行時間 276 ms / 2,000 ms
コード長 253 bytes
コンパイル時間 470 ms
コンパイル使用メモリ 8,352 KB
実行使用メモリ 12,928 KB
最終ジャッジ日時 2025-06-21 02:42:30
合計ジャッジ時間 7,591 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 35
権限があれば一括ダウンロードができます
コンパイルメッセージ
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=150
  l-=1 while t[...l]!=t[l...l+l]
  puts (b/l*t[...l].sum+t[...b%l].sum)%998244353
}
0