結果

問題 No.2324 Two Countries within UEC
ユーザー miya145592miya145592
提出日時 2023-06-18 16:47:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 317 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 86,928 KB
実行使用メモリ 88,232 KB
最終ジャッジ日時 2023-09-09 06:27:46
合計ジャッジ時間 10,216 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 263 ms
87,896 KB
testcase_01 AC 278 ms
88,124 KB
testcase_02 AC 139 ms
79,996 KB
testcase_03 AC 227 ms
85,268 KB
testcase_04 AC 245 ms
86,780 KB
testcase_05 AC 142 ms
80,092 KB
testcase_06 AC 166 ms
81,524 KB
testcase_07 AC 137 ms
79,440 KB
testcase_08 AC 225 ms
85,392 KB
testcase_09 AC 230 ms
85,960 KB
testcase_10 AC 281 ms
88,004 KB
testcase_11 AC 265 ms
88,012 KB
testcase_12 AC 156 ms
79,968 KB
testcase_13 AC 158 ms
80,060 KB
testcase_14 AC 141 ms
79,944 KB
testcase_15 AC 137 ms
79,392 KB
testcase_16 AC 222 ms
84,756 KB
testcase_17 AC 184 ms
81,820 KB
testcase_18 AC 140 ms
80,020 KB
testcase_19 AC 275 ms
88,160 KB
testcase_20 AC 128 ms
78,068 KB
testcase_21 AC 201 ms
85,628 KB
testcase_22 AC 221 ms
88,232 KB
testcase_23 AC 145 ms
80,044 KB
testcase_24 AC 206 ms
86,236 KB
testcase_25 AC 267 ms
88,172 KB
testcase_26 AC 203 ms
87,900 KB
testcase_27 AC 203 ms
88,048 KB
testcase_28 AC 199 ms
87,868 KB
testcase_29 AC 201 ms
88,180 KB
testcase_30 AC 201 ms
87,852 KB
testcase_31 AC 72 ms
70,928 KB
testcase_32 AC 72 ms
71,292 KB
testcase_33 AC 72 ms
71,356 KB
testcase_34 AC 73 ms
71,244 KB
testcase_35 AC 72 ms
70,928 KB
testcase_36 AC 72 ms
71,184 KB
testcase_37 AC 70 ms
71,496 KB
testcase_38 AC 72 ms
70,940 KB
testcase_39 AC 72 ms
71,456 KB
testcase_40 AC 72 ms
71,408 KB
testcase_41 AC 73 ms
71,396 KB
testcase_42 AC 72 ms
71,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, P, Q = map(int, input().split())
XF = [list(map(int, input().split())) for _ in range(Q)]
for x, f in XF:
    if x%P==0:
        if f==0:
            print(M)
        else:
            print(0)
    else:
        invx = pow(x, P-2, P)
        y = f * invx % P
        cnt = (M-y)//P - (-y)//P
        print(cnt)
0