結果

問題 No.2324 Two Countries within UEC
ユーザー fuzmare
提出日時 2023-05-28 15:41:24
言語 C
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 327 bytes
コンパイル時間 1,039 ms
コンパイル使用メモリ 28,288 KB
実行使用メモリ 12,160 KB
最終ジャッジ日時 2024-12-27 08:04:47
合計ジャッジ時間 100,757 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 9 WA * 1 TLE * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
int main(void)
{
  int N, M, P, Q, x, y, f, ans;
  scanf("%d %d %d %d", &N, &M, &P, &Q);
  for (int i = 0; i < Q; i++) {
    scanf("%d %d", &x, &f);
    ans=0;
    for (y = 1; y <= M; y++) {
      if ((x*y)%P==f) {
        ans++;
        y+=(y-f/x)%P;
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
0