結果

問題 No.2324 Two Countries within UEC
ユーザー naut3
提出日時 2023-09-30 13:37:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 332 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 30,592 KB
最終ジャッジ日時 2024-07-23 07:39:47
合計ジャッジ時間 19,300 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    N, M, P, Q = map(int, input().split())

    XF = [list(map(int, input().split())) for _ in range(Q)]

    for i in range(Q):
        x, f = XF[i]

        y_0 = (f * pow(x, P-2, P)) % P

        if y_0 == 0:
            print((M - y_0) // P)
        else:
            print((M - y_0) // P + 1)
    return 0


main()
0