結果
問題 |
No.2324 Two Countries within UEC
|
ユーザー |
|
提出日時 | 2023-06-18 16:47:24 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 249 ms / 2,000 ms |
コード長 | 317 bytes |
コンパイル時間 | 778 ms |
コンパイル使用メモリ | 82,252 KB |
実行使用メモリ | 87,260 KB |
最終ジャッジ日時 | 2024-06-26 23:38:38 |
合計ジャッジ時間 | 8,042 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 |
ソースコード
N, M, P, Q = map(int, input().split()) XF = [list(map(int, input().split())) for _ in range(Q)] for x, f in XF: if x%P==0: if f==0: print(M) else: print(0) else: invx = pow(x, P-2, P) y = f * invx % P cnt = (M-y)//P - (-y)//P print(cnt)