結果

問題 No.816 Beautiful tuples
ユーザー mhr380mhr380
提出日時 2019-04-23 01:32:20
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 371 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 54,316 KB
実行使用メモリ 13,884 KB
最終ジャッジ日時 2024-04-20 13:44:04
合計ジャッジ時間 4,737 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 53 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1,110 ms
5,376 KB
testcase_06 AC 116 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 TLE -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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