結果

問題 No.2324 Two Countries within UEC
ユーザー i39i39
提出日時 2023-05-28 15:08:40
言語 Ruby
(3.3.0)
結果
AC  
実行時間 373 ms / 2,000 ms
コード長 205 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 11,320 KB
実行使用メモリ 15,388 KB
最終ジャッジ日時 2023-09-09 06:14:53
合計ジャッジ時間 12,120 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 361 ms
15,168 KB
testcase_01 AC 373 ms
15,308 KB
testcase_02 AC 131 ms
15,348 KB
testcase_03 AC 295 ms
15,080 KB
testcase_04 AC 324 ms
15,168 KB
testcase_05 AC 134 ms
15,268 KB
testcase_06 AC 178 ms
15,184 KB
testcase_07 AC 124 ms
15,284 KB
testcase_08 AC 298 ms
15,164 KB
testcase_09 AC 297 ms
15,292 KB
testcase_10 AC 370 ms
15,364 KB
testcase_11 AC 363 ms
15,172 KB
testcase_12 AC 164 ms
15,188 KB
testcase_13 AC 164 ms
15,376 KB
testcase_14 AC 128 ms
15,184 KB
testcase_15 AC 121 ms
15,388 KB
testcase_16 AC 281 ms
15,188 KB
testcase_17 AC 203 ms
15,148 KB
testcase_18 AC 133 ms
15,128 KB
testcase_19 AC 365 ms
15,376 KB
testcase_20 AC 114 ms
15,188 KB
testcase_21 AC 274 ms
15,376 KB
testcase_22 AC 335 ms
15,148 KB
testcase_23 AC 156 ms
15,164 KB
testcase_24 AC 292 ms
15,224 KB
testcase_25 AC 366 ms
15,148 KB
testcase_26 AC 298 ms
15,384 KB
testcase_27 AC 298 ms
15,272 KB
testcase_28 AC 296 ms
15,312 KB
testcase_29 AC 294 ms
15,276 KB
testcase_30 AC 293 ms
15,260 KB
testcase_31 AC 78 ms
15,336 KB
testcase_32 AC 78 ms
15,072 KB
testcase_33 AC 77 ms
15,140 KB
testcase_34 AC 78 ms
15,036 KB
testcase_35 AC 77 ms
15,052 KB
testcase_36 AC 78 ms
15,264 KB
testcase_37 AC 78 ms
15,100 KB
testcase_38 AC 77 ms
15,184 KB
testcase_39 AC 77 ms
15,160 KB
testcase_40 AC 77 ms
15,068 KB
testcase_41 AC 77 ms
15,264 KB
testcase_42 AC 77 ms
15,272 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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)
  elsif x%p==0 then
    puts 0
  else
    y=(f*x.pow(p-2,p))%p
    puts (m-y)/p+1
  end
end
0