結果

問題 No.442 和と積
ユーザー fps_Alvin
提出日時 2017-04-05 17:30:24
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 502 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 28,288 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-08 10:52:25
合計ジャッジ時間 771 ms
ジャッジサーバーID
(参考情報)
judge3 / 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 = A;
	}else{
		right = A;
		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\n",most_anser);
	return 0;
}
0