結果

問題 No.2324 Two Countries within UEC
ユーザー hanba-gu1
提出日時 2023-05-28 14:01:03
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 756 bytes
コンパイル時間 3,650 ms
コンパイル使用メモリ 251,156 KB
最終ジャッジ日時 2025-02-13 10:38:31
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 friendship = f; friendship <= M * x; friendship += P){
			if(friendship > 0 && friendship % x == 0) ans++;
		}
		cout << ans << endl;
	}
	
	return 0;
}
0