結果

問題 No.2324 Two Countries within UEC
ユーザー i39i39
提出日時 2023-05-29 17:01:54
言語 Ruby
(3.3.0)
結果
AC  
実行時間 370 ms / 2,000 ms
コード長 203 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 11,396 KB
実行使用メモリ 15,484 KB
最終ジャッジ日時 2023-09-09 06:22:36
合計ジャッジ時間 12,100 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 364 ms
15,388 KB
testcase_01 AC 370 ms
15,384 KB
testcase_02 AC 134 ms
15,256 KB
testcase_03 AC 298 ms
15,388 KB
testcase_04 AC 330 ms
15,184 KB
testcase_05 AC 133 ms
15,372 KB
testcase_06 AC 177 ms
15,380 KB
testcase_07 AC 123 ms
15,416 KB
testcase_08 AC 297 ms
15,280 KB
testcase_09 AC 297 ms
15,188 KB
testcase_10 AC 370 ms
15,268 KB
testcase_11 AC 367 ms
15,376 KB
testcase_12 AC 169 ms
15,408 KB
testcase_13 AC 168 ms
15,300 KB
testcase_14 AC 131 ms
15,484 KB
testcase_15 AC 124 ms
15,384 KB
testcase_16 AC 274 ms
15,308 KB
testcase_17 AC 206 ms
15,212 KB
testcase_18 AC 132 ms
15,212 KB
testcase_19 AC 369 ms
15,148 KB
testcase_20 AC 114 ms
15,452 KB
testcase_21 AC 274 ms
15,300 KB
testcase_22 AC 334 ms
15,108 KB
testcase_23 AC 157 ms
15,348 KB
testcase_24 AC 287 ms
15,232 KB
testcase_25 AC 365 ms
15,380 KB
testcase_26 AC 296 ms
15,184 KB
testcase_27 AC 306 ms
15,424 KB
testcase_28 AC 299 ms
15,356 KB
testcase_29 AC 297 ms
15,224 KB
testcase_30 AC 297 ms
15,380 KB
testcase_31 AC 78 ms
15,084 KB
testcase_32 AC 78 ms
15,264 KB
testcase_33 AC 79 ms
15,268 KB
testcase_34 AC 81 ms
14,980 KB
testcase_35 AC 79 ms
15,160 KB
testcase_36 AC 79 ms
15,292 KB
testcase_37 AC 80 ms
15,232 KB
testcase_38 AC 78 ms
15,156 KB
testcase_39 AC 80 ms
15,304 KB
testcase_40 AC 77 ms
15,228 KB
testcase_41 AC 78 ms
15,224 KB
testcase_42 AC 80 ms
15,128 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 x%p==0 then
    puts (f==0 ? m : 0)
  elsif f==0 then
    puts m/p
  else
    y=(f*x.pow(p-2,p))%p
    puts (m-y)/p+1
  end
end
0