結果
問題 |
No.2324 Two Countries within UEC
|
ユーザー |
|
提出日時 | 2023-05-28 14:47:59 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 473 bytes |
コンパイル時間 | 845 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 77,276 KB |
最終ジャッジ日時 | 2024-12-27 03:00:44 |
合計ジャッジ時間 | 11,051 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 29 WA * 12 |
ソースコード
def INT(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) N, M, P, Q = MI() for i in range(Q): x, f = MI() a = P + f x_inv = pow(x, P - 2, P) y_min = (a * x_inv) % P if y_min == 0: y_min += P ans = 0 if M > y_min: ans = (M - y_min) // P + int((M - y_min) % P != 0) if M == y_min: ans += 1 print(ans)