結果
| 問題 | 
                            No.358 も~っと!門松列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             FF256grhy
                         | 
                    
| 提出日時 | 2016-04-17 22:38:16 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 1,000 ms | 
| コード長 | 426 bytes | 
| コンパイル時間 | 135 ms | 
| コンパイル使用メモリ | 22,912 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-10-04 10:36:16 | 
| 合計ジャッジ時間 | 850 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%d%d%d", &a, &b, &c);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
int isK(int a, int b, int c) {
	return ( (a < b && b > c && a != c) || (a > b && b < c && a != c) );
}
int main() {
	int a, b, c, i;
	scanf("%d%d%d", &a, &b, &c);
	
	if( isK(a, b, c) ) {
		printf("INF\n");
		return 0;
	}
	
	int max = a < b ? b : a;
	max = max < c ? c : max;
	int cnt = 0;
	
	for(i = 1; i <= max; i++) {
		if( isK(a % i, b % i, c % i) ) { cnt++; }
	} 
	
	printf("%d\n", cnt);
	return 0;
}
            
            
            
        
            
FF256grhy