結果

問題 No.2324 Two Countries within UEC
ユーザー konchakoncha
提出日時 2023-05-28 17:12:49
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 88,700 KB
最終ジャッジ日時 2023-09-09 06:20:03
合計ジャッジ時間 10,446 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 270 ms
88,056 KB
testcase_01 AC 280 ms
88,200 KB
testcase_02 AC 143 ms
80,248 KB
testcase_03 AC 235 ms
86,220 KB
testcase_04 AC 247 ms
87,328 KB
testcase_05 AC 145 ms
80,236 KB
testcase_06 AC 168 ms
81,560 KB
testcase_07 AC 142 ms
79,984 KB
testcase_08 AC 226 ms
85,836 KB
testcase_09 AC 231 ms
86,136 KB
testcase_10 AC 281 ms
88,364 KB
testcase_11 AC 277 ms
88,368 KB
testcase_12 AC 163 ms
81,212 KB
testcase_13 AC 160 ms
81,092 KB
testcase_14 AC 141 ms
80,160 KB
testcase_15 AC 141 ms
79,424 KB
testcase_16 AC 221 ms
85,040 KB
testcase_17 AC 184 ms
81,920 KB
testcase_18 AC 144 ms
80,204 KB
testcase_19 AC 278 ms
88,700 KB
testcase_20 AC 136 ms
78,336 KB
testcase_21 AC 210 ms
86,128 KB
testcase_22 AC 221 ms
88,420 KB
testcase_23 AC 153 ms
81,304 KB
testcase_24 AC 219 ms
86,788 KB
testcase_25 AC 278 ms
88,528 KB
testcase_26 AC 203 ms
88,256 KB
testcase_27 AC 202 ms
88,300 KB
testcase_28 AC 201 ms
88,116 KB
testcase_29 AC 202 ms
88,152 KB
testcase_30 AC 204 ms
88,304 KB
testcase_31 AC 72 ms
71,432 KB
testcase_32 AC 74 ms
71,392 KB
testcase_33 AC 73 ms
71,184 KB
testcase_34 AC 74 ms
71,424 KB
testcase_35 AC 74 ms
71,292 KB
testcase_36 AC 72 ms
71,096 KB
testcase_37 AC 73 ms
71,352 KB
testcase_38 AC 73 ms
71,348 KB
testcase_39 AC 72 ms
71,528 KB
testcase_40 AC 72 ms
71,572 KB
testcase_41 AC 71 ms
71,292 KB
testcase_42 AC 73 ms
71,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, M, P, Q = map(int, input().split())
querys = [list(map(int, input().split())) for _ in range(Q)]

for x, f in querys:
    x = x % P
    if x == 0:
        if f == 0:
            answer = M
        else:
            answer = 0
    else:
        answer = M // P
        y = (f * pow(x, P-2, P)) % P
        if y == 0: y = P
        if y <= (M%P):
            answer += 1
    print(answer)
0