結果

問題 No.2324 Two Countries within UEC
ユーザー masa_aamasa_aa
提出日時 2023-05-28 13:49:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 398 ms / 2,000 ms
コード長 339 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 87,092 KB
実行使用メモリ 78,888 KB
最終ジャッジ日時 2023-09-09 06:08:11
合計ジャッジ時間 12,500 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 378 ms
78,600 KB
testcase_01 AC 398 ms
78,372 KB
testcase_02 AC 159 ms
78,100 KB
testcase_03 AC 319 ms
78,724 KB
testcase_04 AC 347 ms
78,588 KB
testcase_05 AC 166 ms
78,376 KB
testcase_06 AC 206 ms
78,780 KB
testcase_07 AC 153 ms
78,516 KB
testcase_08 AC 322 ms
78,632 KB
testcase_09 AC 322 ms
78,352 KB
testcase_10 AC 397 ms
78,220 KB
testcase_11 AC 385 ms
78,464 KB
testcase_12 AC 197 ms
78,652 KB
testcase_13 AC 193 ms
78,548 KB
testcase_14 AC 161 ms
78,100 KB
testcase_15 AC 155 ms
78,100 KB
testcase_16 AC 302 ms
78,552 KB
testcase_17 AC 237 ms
78,296 KB
testcase_18 AC 163 ms
78,200 KB
testcase_19 AC 394 ms
78,676 KB
testcase_20 AC 145 ms
78,164 KB
testcase_21 AC 292 ms
78,888 KB
testcase_22 AC 344 ms
78,740 KB
testcase_23 AC 184 ms
78,496 KB
testcase_24 AC 309 ms
78,728 KB
testcase_25 AC 388 ms
78,596 KB
testcase_26 AC 313 ms
77,196 KB
testcase_27 AC 305 ms
77,276 KB
testcase_28 AC 305 ms
77,088 KB
testcase_29 AC 311 ms
77,224 KB
testcase_30 AC 306 ms
77,344 KB
testcase_31 AC 70 ms
71,128 KB
testcase_32 AC 70 ms
71,176 KB
testcase_33 AC 69 ms
71,308 KB
testcase_34 AC 71 ms
71,220 KB
testcase_35 AC 70 ms
71,216 KB
testcase_36 AC 71 ms
71,336 KB
testcase_37 AC 71 ms
71,308 KB
testcase_38 AC 73 ms
71,124 KB
testcase_39 AC 69 ms
71,248 KB
testcase_40 AC 71 ms
71,400 KB
testcase_41 AC 73 ms
71,332 KB
testcase_42 AC 74 ms
71,352 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