結果

問題 No.816 Beautiful tuples
コンテスト
ユーザー mhr380
提出日時 2019-04-23 01:32:20
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 371 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 273 ms
コンパイル使用メモリ 69,736 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-09-14 15:35:31
合計ジャッジ時間 8,593 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 5 TLE * 2
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <string>
#include <iostream>

int main() {
	int a, b;
	std::cin >> a >> b;

	int c = 1;
	bool flg = false;
	while (c < a * b) {
		int sum1 = a + b;
		int sum2 = b + c;
		int sum3 = c + a;
		
		if (sum1 % c == 0 && sum2 % a == 0 && sum3 % b == 0) {
			std::cout << c << std::endl;
			return 0;
		}
		else {
			c++;
		}
	}
	c = -1;
	std::cout << c << std::endl;
}
0