結果

問題 No.2324 Two Countries within UEC
ユーザー i39
提出日時 2023-05-29 16:59:56
言語 Ruby
(3.4.1)
結果
WA  
実行時間 -
コード長 172 bytes
コンパイル時間 275 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,544 KB
最終ジャッジ日時 2024-12-28 10:00:25
合計ジャッジ時間 12,531 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 1
other AC * 36 WA * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n
Syntax OK

ソースコード

diff #

n,m,p,q=gets.split.map(&:to_i)
q.times do
  x,f=gets.split.map(&:to_i)
  if x%p==0 then
    puts (f==0 ? m : 0)
  else
    y=(f*x.pow(p-2,p))%p
    puts (m-y)/p+1
  end
end
0