結果

問題 No.442 和と積
ユーザー kashi3215kashi3215
提出日時 2018-06-06 18:07:53
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 464 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 25,528 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 22:47:13
合計ジャッジ時間 2,842 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<cstdio>
int main(void) {
	long long int A, B, X, Y, Z, g, g2, G, ANS2, ANS;
    scanf("%lld %lld", &X, &Y);
	A = X;
	B = Y;
	while (A%B != 0 && B % A != 0) {
		if (A > B) { A = A % B; }
		else { B = B % A; }
	}
	if (A > B) { g = B; }
	else { g = A; }
	Z = (A + B) / g;
	G = g;
	while (Z%G != 0 && G % Z != 0) {
		if (Z > g) { Z = Z % G; }
		else {G = G % Z; }
	}
	if (G > Z) { g2 = Z; }
	else { g2 = g; }
	ANS = g * g2;
	printf("%lld", ANS);
	return 0;

}
0