結果
問題 |
No.2324 Two Countries within UEC
|
ユーザー |
|
提出日時 | 2023-05-28 14:07:34 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 569 bytes |
コンパイル時間 | 627 ms |
コンパイル使用メモリ | 67,792 KB |
実行使用メモリ | 17,096 KB |
最終ジャッジ日時 | 2024-12-26 23:32:00 |
合計ジャッジ時間 | 98,509 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 10 TLE * 31 |
ソースコード
#include <iostream> #include <vector> int main() { int N, M, P, Q; std::cin >> N >> M >> P >> Q; for (int i = 0; i < Q; i++) { int x, f; std::cin >> x >> f; int ans = 0; int modX = x % P; // x%P の結果を保持 for (int j = 1; j <= M; j++) { if(j<P)if((j * modX) % P == f) { ans++; continue; } if (((j%P) * modX) % P == f) { ans++; } } std::cout << ans << std::endl; } return 0; }