結果

問題 No.2324 Two Countries within UEC
ユーザー kemunikukemuniku
提出日時 2023-05-28 14:23:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 403 ms / 2,000 ms
コード長 347 bytes
コンパイル時間 636 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 79,080 KB
最終ジャッジ日時 2023-09-09 06:12:48
合計ジャッジ時間 12,774 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 382 ms
78,928 KB
testcase_01 AC 401 ms
78,888 KB
testcase_02 AC 163 ms
78,432 KB
testcase_03 AC 327 ms
78,804 KB
testcase_04 AC 349 ms
78,780 KB
testcase_05 AC 167 ms
78,344 KB
testcase_06 AC 205 ms
78,556 KB
testcase_07 AC 155 ms
78,444 KB
testcase_08 AC 312 ms
78,736 KB
testcase_09 AC 319 ms
78,832 KB
testcase_10 AC 403 ms
78,988 KB
testcase_11 AC 387 ms
78,544 KB
testcase_12 AC 193 ms
78,728 KB
testcase_13 AC 195 ms
78,812 KB
testcase_14 AC 163 ms
78,296 KB
testcase_15 AC 155 ms
78,288 KB
testcase_16 AC 304 ms
79,080 KB
testcase_17 AC 238 ms
79,032 KB
testcase_18 AC 160 ms
78,408 KB
testcase_19 AC 393 ms
78,992 KB
testcase_20 AC 144 ms
78,292 KB
testcase_21 AC 299 ms
78,756 KB
testcase_22 AC 341 ms
78,712 KB
testcase_23 AC 184 ms
78,716 KB
testcase_24 AC 308 ms
78,524 KB
testcase_25 AC 397 ms
78,936 KB
testcase_26 AC 313 ms
77,560 KB
testcase_27 AC 318 ms
77,400 KB
testcase_28 AC 315 ms
77,632 KB
testcase_29 AC 309 ms
77,212 KB
testcase_30 AC 316 ms
77,588 KB
testcase_31 AC 70 ms
71,340 KB
testcase_32 AC 70 ms
71,392 KB
testcase_33 AC 70 ms
71,244 KB
testcase_34 AC 68 ms
71,248 KB
testcase_35 AC 69 ms
71,244 KB
testcase_36 AC 70 ms
71,140 KB
testcase_37 AC 71 ms
71,304 KB
testcase_38 AC 70 ms
71,352 KB
testcase_39 AC 70 ms
71,364 KB
testcase_40 AC 71 ms
71,612 KB
testcase_41 AC 72 ms
71,592 KB
testcase_42 AC 70 ms
71,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,P,Q = map(int,input().split())
for i in range(Q):
    x,f = map(int,input().split())
    if x%P == 0:
        if f == 0:
            print(M)
        else:
            print(0)
    else:
        y = f*pow(x,P-2,P)%P
        if y == 0:
            y = P
        if y >M:
            print(0)
        else:
            print((M-y)//P+1)
        
0