結果

問題 No.2324 Two Countries within UEC
ユーザー lloyzlloyz
提出日時 2023-06-03 01:42:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 371 bytes
コンパイル時間 386 ms
コンパイル使用メモリ 86,840 KB
実行使用メモリ 79,340 KB
最終ジャッジ日時 2023-08-28 07:20:47
合計ジャッジ時間 12,105 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 376 ms
78,776 KB
testcase_01 AC 398 ms
78,820 KB
testcase_02 AC 160 ms
78,296 KB
testcase_03 AC 317 ms
78,588 KB
testcase_04 AC 341 ms
78,580 KB
testcase_05 AC 163 ms
78,020 KB
testcase_06 AC 207 ms
78,764 KB
testcase_07 AC 153 ms
78,084 KB
testcase_08 AC 317 ms
78,548 KB
testcase_09 AC 317 ms
78,788 KB
testcase_10 AC 394 ms
78,940 KB
testcase_11 AC 385 ms
78,512 KB
testcase_12 AC 196 ms
78,880 KB
testcase_13 AC 195 ms
78,636 KB
testcase_14 AC 160 ms
78,224 KB
testcase_15 AC 153 ms
78,028 KB
testcase_16 AC 303 ms
78,848 KB
testcase_17 AC 238 ms
78,588 KB
testcase_18 AC 163 ms
78,060 KB
testcase_19 AC 389 ms
78,796 KB
testcase_20 AC 144 ms
78,252 KB
testcase_21 WA -
testcase_22 AC 337 ms
78,516 KB
testcase_23 AC 185 ms
78,524 KB
testcase_24 WA -
testcase_25 AC 393 ms
78,620 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 69 ms
71,148 KB
testcase_32 AC 68 ms
71,336 KB
testcase_33 AC 69 ms
71,020 KB
testcase_34 AC 69 ms
71,196 KB
testcase_35 AC 70 ms
71,012 KB
testcase_36 AC 69 ms
71,508 KB
testcase_37 AC 68 ms
71,208 KB
testcase_38 AC 69 ms
71,464 KB
testcase_39 AC 69 ms
71,496 KB
testcase_40 AC 70 ms
71,392 KB
testcase_41 AC 69 ms
71,180 KB
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, p, q = map(int, input().split())
c, r = divmod(m, p)
for _ in range(q):
    x, f = map(int, input().split())
    if x % p == 0:
        if f % p != 0:
            print(0)
        else:
            print(c)
        continue
    y = f * pow(x, p - 2, p) % p
    if y <= r:
        ans = c + 1
    else:
        ans = c
    if y == 0:
        ans -= 1
    print(ans)
0