結果

問題 No.442 和と積
ユーザー hotpepsi
提出日時 2016-11-18 01:19:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 370 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 57,640 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-26 03:29:51
合計ジャッジ時間 1,053 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>

using namespace std;

typedef long long LL;

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

int main(int argc, char *argv[]) {
	LL a, b;
	cin >> a >> b;
	LL ag = gcd(a + b, a);
	LL bg = gcd(a + b, b);
	LL gg = gcd(ag, bg);
	LL ans = (ag / gg) * bg;
	cout << ans << endl;
	return 0;
}
0