結果

問題 No.2324 Two Countries within UEC
ユーザー masa_aamasa_aa
提出日時 2023-05-28 13:49:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 409 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 938 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 78,944 KB
最終ジャッジ日時 2023-09-09 06:07:33
合計ジャッジ時間 13,430 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 385 ms
78,540 KB
testcase_01 AC 409 ms
78,624 KB
testcase_02 AC 162 ms
78,088 KB
testcase_03 AC 323 ms
78,504 KB
testcase_04 AC 352 ms
78,504 KB
testcase_05 AC 164 ms
78,416 KB
testcase_06 AC 208 ms
78,512 KB
testcase_07 AC 153 ms
78,116 KB
testcase_08 AC 317 ms
78,476 KB
testcase_09 AC 326 ms
78,508 KB
testcase_10 AC 399 ms
78,428 KB
testcase_11 AC 389 ms
78,548 KB
testcase_12 AC 195 ms
78,544 KB
testcase_13 AC 195 ms
78,944 KB
testcase_14 AC 161 ms
78,160 KB
testcase_15 AC 157 ms
78,108 KB
testcase_16 AC 310 ms
78,312 KB
testcase_17 AC 233 ms
78,236 KB
testcase_18 AC 165 ms
78,104 KB
testcase_19 AC 395 ms
78,724 KB
testcase_20 AC 146 ms
78,104 KB
testcase_21 AC 295 ms
78,448 KB
testcase_22 AC 348 ms
78,468 KB
testcase_23 AC 184 ms
78,388 KB
testcase_24 AC 313 ms
78,524 KB
testcase_25 AC 392 ms
78,616 KB
testcase_26 AC 315 ms
77,380 KB
testcase_27 AC 315 ms
77,352 KB
testcase_28 AC 315 ms
77,208 KB
testcase_29 AC 312 ms
77,216 KB
testcase_30 AC 317 ms
77,276 KB
testcase_31 AC 71 ms
71,132 KB
testcase_32 AC 71 ms
71,256 KB
testcase_33 AC 69 ms
71,000 KB
testcase_34 AC 71 ms
71,256 KB
testcase_35 AC 69 ms
71,076 KB
testcase_36 AC 70 ms
71,020 KB
testcase_37 AC 69 ms
70,996 KB
testcase_38 AC 72 ms
71,108 KB
testcase_39 AC 71 ms
71,228 KB
testcase_40 AC 71 ms
71,072 KB
testcase_41 AC 70 ms
71,224 KB
testcase_42 AC 71 ms
71,228 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, p, q = map(int, input().split())
for _ in range(q):
    x, f = map(int, input().split())
    x %= p
    if x == 0:
        if f == 0:
            print(m)
        else:
            print(0)

    else:
        y = f * pow(x, p - 2, p) % p
        if y == 0:
            print(m // p)
        else:
            print((m - y + p) // p)
0