結果
| 問題 | No.442 和と積 | 
| コンテスト | |
| ユーザー |  fps_Alvin | 
| 提出日時 | 2017-04-05 17:03:47 | 
| 言語 | C (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 372 bytes | 
| コンパイル時間 | 112 ms | 
| コンパイル使用メモリ | 28,032 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-08 10:51:29 | 
| 合計ジャッジ時間 | 960 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 5 WA * 12 RE * 1 | 
ソースコード
#include <stdio.h>
int main(void)
{
	int A,B,surplus = 1,left,right,most_anser;
	scanf("%d %d",&A,&B);
	
	if(A+B < A*B){
		right = A+B;
		left = A*B;
	}else{
		right = A*B;
		left = A+B;
	}
	
	while(surplus != 0){
		surplus = left % right;
		//最大公約数を保存
		most_anser = right;
		left = right;
		right = surplus;
	}
	
	printf("%d",most_anser);
	return 0;
}
            
            
            
        