結果

問題 No.358 も~っと!門松列
ユーザー Naoyk1212
提出日時 2016-07-28 19:16:41
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 645 bytes
コンパイル時間 1,272 ms
コンパイル使用メモリ 158,188 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-06 18:13:24
合計ジャッジ時間 2,105 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

bool isKadomatsu(int a, int b, int c){
  if(a != b && a != c && b != c){
    if(a < b){
      if(b > c){
//        cout << a << b << c << endl;
        return true;
      }
    }else if(a > b){
      if(b < c){
//        cout << a << b << c << endl;
        return true;
      }
    }
  }    
  return false;
}

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  int count = 0;
  if(isKadomatsu(a, b, c) == true){
    cout << "INF" << endl;
  }else{
    for(int i = 1; i <= max(max(a, b), c); i++){
      if(isKadomatsu(a % i, b % i, c % i) == true) count++;
    }
    cout << count << endl;
  }
}

0