結果

問題 No.2324 Two Countries within UEC
ユーザー hiro71687k
提出日時 2023-06-07 23:44:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
RE  
実行時間 -
コード長 597 bytes
コンパイル時間 4,223 ms
コンパイル使用メモリ 251,852 KB
最終ジャッジ日時 2025-02-13 23:19:04
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 30 RE * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ld=long double;
ld pie=3.141592653589793;
ll inf=20000000000000;
ll mod=998244353;
int main(){
    ll n,m,p,q;
    cin >> n >> m >> p >> q;
    vector<ll>a;
    for (ll i = 0; i < q; i++)
    {
        ll x,f;
        cin >> x >> f;
        ll z=f*inv_mod(x,p);
        z%=p;
        ll ans=m/p;
        if (z<=m%p&&z!=0)
        {
            ans++;
        }
        a.push_back(ans);
    }
    for (ll i = 0; i < a.size(); i++)
    {
        cout << a[i] <<endl;
    }
    
}
0