結果
| 問題 |
No.2324 Two Countries within UEC
|
| コンテスト | |
| ユーザー |
manjuuu_onsen
|
| 提出日時 | 2023-05-28 16:28:45 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 463 bytes |
| コンパイル時間 | 1,945 ms |
| コンパイル使用メモリ | 197,020 KB |
| 最終ジャッジ日時 | 2025-02-13 15:17:44 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 30 RE * 11 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int,int>;
#include<atcoder/math>
using namespace atcoder;
//#include"debug.hpp"
int main()
{
ll N, M, P, Q;
cin >> N >> M >> P >> Q;
for(int i = 0; i < Q; i++) {
ll x, f; cin >> x >> f;
ll y = inv_mod(x, P) * f;
y %= P;
// print(y);
if(y == 0) {
cout << M / P << endl;
}
else if(y > M) cout << 0 << endl;
else cout << (M - y) / P + 1 << endl;;
}
}
manjuuu_onsen