結果

問題 No.2324 Two Countries within UEC
ユーザー i39i39
提出日時 2023-05-28 13:45:59
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 210 bytes
コンパイル時間 603 ms
コンパイル使用メモリ 11,336 KB
実行使用メモリ 15,444 KB
最終ジャッジ日時 2023-08-27 08:25:20
合計ジャッジ時間 11,537 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 365 ms
15,268 KB
testcase_01 AC 377 ms
15,380 KB
testcase_02 AC 133 ms
15,288 KB
testcase_03 AC 299 ms
15,280 KB
testcase_04 AC 329 ms
15,284 KB
testcase_05 AC 135 ms
15,260 KB
testcase_06 AC 180 ms
15,276 KB
testcase_07 AC 124 ms
15,156 KB
testcase_08 AC 296 ms
15,412 KB
testcase_09 AC 302 ms
15,344 KB
testcase_10 AC 375 ms
15,444 KB
testcase_11 AC 366 ms
15,436 KB
testcase_12 AC 167 ms
15,260 KB
testcase_13 AC 170 ms
15,352 KB
testcase_14 AC 133 ms
15,276 KB
testcase_15 AC 126 ms
15,272 KB
testcase_16 AC 281 ms
15,156 KB
testcase_17 AC 208 ms
15,232 KB
testcase_18 AC 137 ms
15,436 KB
testcase_19 AC 373 ms
15,436 KB
testcase_20 AC 117 ms
15,268 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 379 ms
15,416 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 79 ms
15,036 KB
testcase_32 AC 81 ms
15,080 KB
testcase_33 AC 79 ms
15,096 KB
testcase_34 AC 80 ms
15,240 KB
testcase_35 AC 80 ms
15,040 KB
testcase_36 AC 80 ms
15,284 KB
testcase_37 AC 80 ms
15,160 KB
testcase_38 AC 81 ms
15,288 KB
testcase_39 AC 81 ms
15,160 KB
testcase_40 AC 81 ms
15,160 KB
testcase_41 WA -
testcase_42 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 f==0 then
    puts (x%p==0 ? m : m/p)
    next
  else
    y=f*x.pow(p-2,p)%p
    puts (m-y)/p-(1-y)/p-((1-y)%p==0 ? 0 : 1)+1
  end
end
0