結果

問題 No.2324 Two Countries within UEC
ユーザー eizi
提出日時 2023-05-28 15:47:04
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 486 bytes
コンパイル時間 1,816 ms
コンパイル使用メモリ 193,480 KB
最終ジャッジ日時 2025-02-13 13:59:50
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 1 TLE * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = unsigned long long;
using Graph = vector<vector<int>>;

int main()
{
    int n, m, p, q;
    cin >> n >> m >> p >> q;
    rep(i, q)
    {
        int x, f;
        cin >> x >> f;
        ll ans = 0;
        for (int j = 1; j < m + 1; j++)
        {
            ll xy = x * j;
            if ((xy - f) % p == 0)
                ans++;
        }
        cout << ans << endl;
    }
}
0