結果

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

ソースコード

diff #

#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
 
#define MOD 1000000009

int isKadomatsu(int a, int b, int c){
  if((a<b&&a>c)||(a>b&&a<c)||(c<a&&c>b)||(c>a&&c<b))return 1;
  return 0;
}

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(isKadomatsu(a,b,c)==1){
    cout << "INF" << endl;
    return 0;
  }
  if(a==b||a==c||b==c){
    cout << 0 << endl;
    return 0;
  }
  int ans = 0;
  rep(i,1,2000){
    int a1 = a%i;
    int b1 = b%i;
    int c1 = c%i;
    if(isKadomatsu(a1,b1,c1)==1){
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
0