結果

問題 No.2558 中国剰余定理
ユーザー elphe
提出日時 2024-07-15 18:55:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 262 bytes
コンパイル時間 528 ms
コンパイル使用メモリ 66,408 KB
最終ジャッジ日時 2025-02-23 15:47:43
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;

int main()
{
	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int A, B, a, b, x;
	cin >> A >> B >> a >> b;

	for (x = 0; ; ++x)
		if (x % A == a && x % B == b)
		{
			cout << x << '\n';
			return 0;
		}

	return -1;
}
0