結果
| 問題 | No.2558 中国剰余定理 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-12-07 18:21:41 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 1,330 ms / 2,000 ms |
| コード長 | 554 bytes |
| 記録 | |
| コンパイル時間 | 1,611 ms |
| コンパイル使用メモリ | 166,364 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-27 02:15:18 |
| 合計ジャッジ時間 | 26,165 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (int)s; i < (int)(n); i++)
using namespace std;
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
int main() {
int A, B, a, b;
cin >> A >> B >> a >> b;
int ans = 2e9;
rep(i, 2e8) {
if (i % A == a && i % B == b) {
chmin(ans, i);
}
}
cout << ans << endl;
}