結果

問題 No.2558 中国剰余定理
ユーザー may17may17
提出日時 2023-12-02 14:47:53
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 2,108 ms
コンパイル使用メモリ 198,712 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-26 17:25:35
合計ジャッジ時間 3,043 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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