結果

問題 No.442 和と積
ユーザー fps_Alvin
提出日時 2017-04-05 17:25:20
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 500 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 28,288 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-08 10:51:53
合計ジャッジ時間 842 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main(void)
{
	unsigned long long A,B,surplus = 1,left,right,most_anser;
	scanf("%llu %llu",&A,&B);
//				printf("%llu %llu\n",A, B);

	if(A+B < A*B){
		right = A+B;
		left = B;
	}else{
		right = B;
		left = A+B;
	}
	//		printf("%llu %llu\n",left, right);
	while(surplus != 0){
		surplus = left % right;
		//最大公約数を保存
		most_anser = right;
		left = right;
		right = surplus;
	//		printf("%llu %llu\n",left, right);

	}
	
	printf("%llu",most_anser);
	return 0;
}
0