結果

問題 No.442 和と積
ユーザー stone_725
提出日時 2018-07-03 14:54:23
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 504 bytes
コンパイル時間 2,053 ms
コンパイル使用メモリ 161,736 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-30 12:35:43
合計ジャッジ時間 2,636 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10 WA * 8
権限があれば一括ダウンロードができます

ソースコード

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