結果
| 問題 | No.442 和と積 | 
| コンテスト | |
| ユーザー | 👑 | 
| 提出日時 | 2019-03-31 11:13:28 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 468 bytes | 
| コンパイル時間 | 633 ms | 
| コンパイル使用メモリ | 72,208 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-04 23:17:23 | 
| 合計ジャッジ時間 | 1,450 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 18 | 
ソースコード
#include <cstdio>
#include <cstdlib>
#include <cstddef>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <iostream>
#include <iomanip>
long getgcd(long a, long b) {
	while (0 < a && 0 < b) {
		if (a < b)
			b = b % a;
		else
			a = a % b;
	}
	return std::max(a, b);
}
int main(void)
{
	long a, b, c, d;
	std::cin >> a >> b;
    c = a + b;
    d = getgcd(a, c);
    d *= getgcd(c / d, b);
	std::cout << d << std::endl;
	return 0;
}
            
            
            
        