結果
問題 |
No.2324 Two Countries within UEC
|
ユーザー |
![]() |
提出日時 | 2023-05-28 13:36:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 601 bytes |
コンパイル時間 | 4,078 ms |
コンパイル使用メモリ | 227,128 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-26 21:10:51 |
合計ジャッジ時間 | 9,692 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 RE * 11 |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 int main(){ int N,M; cin>>N>>M; int P,Q; cin>>P>>Q; rep(i,Q){ int x,y; cin>>x>>y; if(y==0){ if(x%P==0){ cout<<M<<endl; } else{ cout<<M/P<<endl; } } else{ long long t = y; t *= inv_mod(x,P); t %= P; // cout<<t<<endl; long long ans = M/P; if(M%P>=t)ans++; cout<<ans<<endl; } } return 0; }