結果

問題 No.2558 中国剰余定理
ユーザー YukiYuki
提出日時 2023-12-07 18:21:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,401 ms / 2,000 ms
コード長 554 bytes
コンパイル時間 1,578 ms
コンパイル使用メモリ 166,376 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2023-12-07 18:22:10
合計ジャッジ時間 29,024 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 929 ms
6,676 KB
testcase_01 AC 1,401 ms
6,676 KB
testcase_02 AC 681 ms
6,676 KB
testcase_03 AC 702 ms
6,676 KB
testcase_04 AC 680 ms
6,676 KB
testcase_05 AC 1,400 ms
6,676 KB
testcase_06 AC 1,015 ms
6,676 KB
testcase_07 AC 1,379 ms
6,676 KB
testcase_08 AC 682 ms
6,676 KB
testcase_09 AC 784 ms
6,676 KB
testcase_10 AC 681 ms
6,676 KB
testcase_11 AC 695 ms
6,676 KB
testcase_12 AC 707 ms
6,676 KB
testcase_13 AC 684 ms
6,676 KB
testcase_14 AC 716 ms
6,676 KB
testcase_15 AC 680 ms
6,676 KB
testcase_16 AC 705 ms
6,676 KB
testcase_17 AC 685 ms
6,676 KB
testcase_18 AC 681 ms
6,676 KB
testcase_19 AC 706 ms
6,676 KB
testcase_20 AC 692 ms
6,676 KB
testcase_21 AC 677 ms
6,676 KB
testcase_22 AC 704 ms
6,676 KB
testcase_23 AC 680 ms
6,676 KB
testcase_24 AC 678 ms
6,676 KB
testcase_25 AC 703 ms
6,676 KB
testcase_26 AC 677 ms
6,676 KB
testcase_27 AC 681 ms
6,676 KB
testcase_28 AC 700 ms
6,676 KB
testcase_29 AC 687 ms
6,676 KB
testcase_30 AC 681 ms
6,676 KB
testcase_31 AC 711 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0