結果
| 問題 | 
                            No.358 も~っと!門松列
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tenkyu9
                         | 
                    
| 提出日時 | 2018-03-18 06:09:26 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 3 ms / 1,000 ms | 
| コード長 | 651 bytes | 
| コンパイル時間 | 653 ms | 
| コンパイル使用メモリ | 79,804 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-12-25 16:23:27 | 
| 合計ジャッジ時間 | 1,555 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 23 | 
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
using namespace std;
typedef long long int ll;
int main(){
	int a1, a2, a3;
	cin >> a1 >> a2 >> a3;
	if(a1==a3){
		cout << 0 << endl;
		return 0;
	}
	if(a1<a2 && a3<a2){
		cout << "INF" << endl;
		return 0;
	} else if(a2<a1 && a2<a3){
		cout << "INF" << endl;
		return 0;
	}
	int ans=0;
	for(int i=1; i<1001; i++){
		if(a1%i<a2%i && a3%i<a2%i && a1%i!=a3%i){
			ans++;
		} else if(a2%i<a1%i && a2%i<a3%i && a1%i!=a3%i){
			ans++;
		}
	}
	cout << ans << endl;
  
  return 0;
}
            
            
            
        
            
tenkyu9