結果

問題 No.2324 Two Countries within UEC
ユーザー titiatitia
提出日時 2023-07-23 02:21:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 824 ms / 2,000 ms
コード長 351 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 11,936 KB
実行使用メモリ 10,136 KB
最終ジャッジ日時 2023-10-24 08:54:07
合計ジャッジ時間 19,141 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 791 ms
10,136 KB
testcase_01 AC 824 ms
10,136 KB
testcase_02 AC 170 ms
10,136 KB
testcase_03 AC 621 ms
10,136 KB
testcase_04 AC 704 ms
10,136 KB
testcase_05 AC 178 ms
10,136 KB
testcase_06 AC 304 ms
10,136 KB
testcase_07 AC 151 ms
10,136 KB
testcase_08 AC 629 ms
10,136 KB
testcase_09 AC 641 ms
10,136 KB
testcase_10 AC 813 ms
10,136 KB
testcase_11 AC 813 ms
10,136 KB
testcase_12 AC 268 ms
10,136 KB
testcase_13 AC 270 ms
10,136 KB
testcase_14 AC 167 ms
10,136 KB
testcase_15 AC 149 ms
10,136 KB
testcase_16 AC 560 ms
10,136 KB
testcase_17 AC 367 ms
10,136 KB
testcase_18 AC 180 ms
10,136 KB
testcase_19 AC 820 ms
10,136 KB
testcase_20 AC 129 ms
10,136 KB
testcase_21 AC 565 ms
10,136 KB
testcase_22 AC 730 ms
10,136 KB
testcase_23 AC 243 ms
10,136 KB
testcase_24 AC 605 ms
10,136 KB
testcase_25 AC 822 ms
10,136 KB
testcase_26 AC 608 ms
10,136 KB
testcase_27 AC 609 ms
10,136 KB
testcase_28 AC 612 ms
10,136 KB
testcase_29 AC 600 ms
10,136 KB
testcase_30 AC 614 ms
10,136 KB
testcase_31 AC 28 ms
10,120 KB
testcase_32 AC 28 ms
10,120 KB
testcase_33 AC 28 ms
10,120 KB
testcase_34 AC 27 ms
10,120 KB
testcase_35 AC 27 ms
10,120 KB
testcase_36 AC 28 ms
10,120 KB
testcase_37 AC 27 ms
10,120 KB
testcase_38 AC 28 ms
10,120 KB
testcase_39 AC 28 ms
10,120 KB
testcase_40 AC 27 ms
10,120 KB
testcase_41 AC 28 ms
10,120 KB
testcase_42 AC 27 ms
10,120 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=pow(x,-1,P)*f%P

        #print(y)

        ANS=M//P

        if y==0:
            ANS-=1

        
        if M%P>=y:
            ANS+=1
        print(ANS)
0