結果

問題 No.442 和と積
ユーザー stone_725stone_725
提出日時 2018-07-03 14:54:23
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 2,256 ms
コンパイル使用メモリ 134,316 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-20 10:52:17
合計ジャッジ時間 2,609 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

unsigned long long gcd(unsigned long long a, unsigned long long b) {
	return b ? gcd(b, a % b) : a;
}

void hawawa()
{
	unsigned long long a, b;
	cin >> a >> b;
	unsigned long long score1 = gcd(a + b, max(a, b));
	unsigned long long score2 = gcd(a + b, min(a, b));
	unsigned long long score3 = gcd(a + b, min(a, b) / gcd(score1, score2));
	cout << score1 * score3 << "\n";
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	hawawa();
	return 0;
}
0