結果
問題 |
No.2324 Two Countries within UEC
|
ユーザー |
|
提出日時 | 2023-05-28 15:21:23 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 920 bytes |
コンパイル時間 | 3,557 ms |
コンパイル使用メモリ | 251,460 KB |
最終ジャッジ日時 | 2025-02-13 13:04:13 |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 WA * 1 TLE * 31 |
ソースコード
#include<bits/stdc++.h> #include<atcoder/all> using namespace std; using namespace atcoder; using ll = int_fast64_t; using ull = uint_fast64_t; using mint = modint998244353; constexpr ll INF = 1ll << 60; template<typename T, typename D> void printelem(const T& container, const D& divide){ for(const auto& i : container) cout << i << divide; cout << endl; } template<typename T> void printelem(const T& container) { printelem(container, ", "); } int main(){ //インプット ll N, M, P, Q; cin >> N >> M >> P >> Q; for(ll q = 0; q < Q; q++){ ll x, f; cin >> x >> f; ll first = -1; for(ll i = x; i <= x*M; i += x){ if(i % P == f){ first = i; break; } } ll ans = 0; for(ll i = first; i <= x*M; i += x*P){ ans++; } if(first > 0) cout << ans << endl; else cout << 0 << endl; // if(first > 0) cout << (x*M-first)/(x*P) << endl; // else cout << 0 << endl; } return 0; }