結果

問題 No.442 和と積
ユーザー kurenai3110
提出日時 2016-11-11 22:28:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 332 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 57,520 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-25 08:28:30
合計ジャッジ時間 1,012 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 7
権限があれば一括ダウンロードができます

ソースコード

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);
	e = gcd(c, b);

	ll ans = gcd(d, e);

	cout << ans << endl;

    return 0;
}
0