結果

問題 No.442 和と積
ユーザー kurenai3110kurenai3110
提出日時 2016-11-11 22:36:10
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 336 bytes
コンパイル時間 678 ms
コンパイル使用メモリ 57,372 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-04 22:22:39
合計ジャッジ時間 1,613 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) {
	while (a) {
		b %= a;
		swap(a, b);
	}
	return b;
}

int main()
{
	ll a, b; cin >> a >> b;
	ll c = a + b;

	ll d, e;
	d = gcd(c, a);
	c /= d;
	e = gcd(c, b);

	ll ans = d*e;

	cout << ans << endl;

    return 0;
}
0