結果

問題 No.2324 Two Countries within UEC
ユーザー fuzmare
提出日時 2023-05-28 15:42:25
言語 C
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 347 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 28,672 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-12-27 08:11:37
合計ジャッジ時間 99,034 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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);
    fflush(stdout);
  }
  return 0;
}
0