結果

問題 No.2324 Two Countries within UEC
ユーザー hanba-gu1
提出日時 2023-05-28 14:32:54
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 700 bytes
コンパイル時間 3,715 ms
コンパイル使用メモリ 250,624 KB
最終ジャッジ日時 2025-02-13 11:42:01
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 10 TLE * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 ans = 0;
		for(ll i = x; i <= x*M; i += x){
			if(i % P == f) ans++;
		}
		cout << ans << endl;
	}
	
	return 0;
}
0