結果
問題 |
No.2324 Two Countries within UEC
|
ユーザー |
|
提出日時 | 2023-05-28 15:55:23 |
言語 | C (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 482 bytes |
コンパイル時間 | 1,087 ms |
コンパイル使用メモリ | 27,776 KB |
実行使用メモリ | 15,312 KB |
最終ジャッジ日時 | 2024-12-27 09:47:01 |
合計ジャッジ時間 | 98,800 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 WA * 1 TLE * 31 |
ソースコード
#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++) { fprintf(stderr, "x=%d,y=%d,(x*y-f)/P=%d\n", x, y, (x*y)%P); if ((x*y)%P==f) { fprintf(stderr, "(x*y)modP=f\n"); ans++; break; } } ans+=(M-y)/P; fprintf(stderr, "%d\n\n", ans); printf("%d\n", ans); } return 0; }