結果
問題 | No.2558 中国剰余定理 |
ユーザー |
|
提出日時 | 2023-12-02 14:47:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 352 bytes |
コンパイル時間 | 1,896 ms |
コンパイル使用メモリ | 191,560 KB |
最終ジャッジ日時 | 2025-02-18 03:57:00 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h>//#include<atcoder/all>using namespace std;//using namespace atcoder;using ll = long long;const ll mod = 1000000007;//const ll mod = 998244353;int A, B, a, b;int main() {cin >> A >> B >> a >> b;int now = 0;while (1) {if (((A * now+a) % B) == b) {cout << A * now + a << endl;return 0;}now++;}}