結果
| 問題 | No.2324 Two Countries within UEC |
| コンテスト | |
| ユーザー |
googol_S0
|
| 提出日時 | 2023-05-28 13:37:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 369 ms / 2,000 ms |
| コード長 | 305 bytes |
| コンパイル時間 | 875 ms |
| コンパイル使用メモリ | 81,840 KB |
| 実行使用メモリ | 76,920 KB |
| 最終ジャッジ日時 | 2024-06-26 23:12:35 |
| 合計ジャッジ時間 | 10,845 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 41 |
ソースコード
N,M,P,Q=map(int,input().split())
for i in range(Q):
x,f=map(int,input().split())
x%=P
if f==0:
if x==0:
print(M)
else:
print(M//P)
else:
if x==0:
print(0)
continue
v=pow(x,P-2,P)*f%P
print((M+P-v)//P)
googol_S0