結果
| 問題 | 
                            No.358 も~っと!門松列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             suppy193
                         | 
                    
| 提出日時 | 2016-04-18 13:10:37 | 
| 言語 | C90  (gcc 12.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 1,000 ms | 
| コード長 | 561 bytes | 
| コンパイル時間 | 231 ms | 
| コンパイル使用メモリ | 20,992 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-04 13:28:51 | 
| 合計ジャッジ時間 | 1,131 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
コンパイルメッセージ
main.c: In function ‘check_kadomatsu’:
main.c:3:5: warning: type of ‘a1’ defaults to ‘int’ [-Wimplicit-int]
    3 | int check_kadomatsu(a1, a2, a3)
      |     ^~~~~~~~~~~~~~~
main.c:3:5: warning: type of ‘a2’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:5: warning: type of ‘a3’ defaults to ‘int’ [-Wimplicit-int]
main.c: In function ‘main’:
main.c:19:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   19 |         scanf("%d%d%d", &a1, &a2, &a3);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
int check_kadomatsu(a1, a2, a3)
{
	if(((a1 < a2 && a2 > a3) || (a1 > a2 && a2 < a3))  && a1 != a3){
		return 1;
	}
	else{
		return 0;
	}
}
int main(void) {
	int a1, a2, a3;
	int b1, b2, b3;
	int max = 0;
	int i;
	int count = 0;
	scanf("%d%d%d", &a1, &a2, &a3);
	if(check_kadomatsu(a1, a2, a3) == 1){
		printf("INF\n");
		return 0;
	}
	max = a1;
	if(max < a2){
		max = a2;
	}
	if (max < a3){
		max = a3;
	}
	for(i = 1;i <= max;i++){
		if(check_kadomatsu(a1 % i, a2 % i, a3 % i) == 1){
			count++;
		}
	}
	printf("%d\n", count);
	return 0;
}
            
            
            
        
            
suppy193