結果

問題 No.358 も~っと!門松列
ユーザー tokizotokizo
提出日時 2018-01-17 11:22:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,249 bytes
コンパイル時間 2,065 ms
コンパイル使用メモリ 163,724 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-25 20:32:01
合計ジャッジ時間 2,600 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,384 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,384 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,500 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 1 ms
4,380 KB
testcase_22 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <typeinfo>
#include <climits>
#include <ctype.h>
#include <string>
#include <stack>
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, n) for (int i = a; i < n; i++)
#define REP(i, n) for(int i = 0; i < n; i++)
struct omt{omt(){ios::sync_with_stdio(false);cin.tie(0);}}star;

int main(){
    int A[3];
    REP(i, 3) cin >> A[i];

    int f = 0, ma = 0, mi = 1001;
    if((A[0] != A[1]) and (A[1] != A[2]) and (A[0] != A[2])){
        REP(i, 3){
            if(A[i] > ma) ma = A[i];
            else if(A[i] < mi) mi = A[i];
        }
        if((ma == A[1]) or (mi == A[1])) f = 1;
    }
    if(f == 0){
        int cnt = 0;
        FOR(i, 1, ma + 1){
            int B[3];
            int ma2 = INT_MIN;
            int mi2 = INT_MAX;
            REP(j, 3){
                B[j] = A[j] % i;
                if(B[j] > ma2) ma2 = B[j];
                else if(B[j] < mi2) mi2 = B[j];
            }
            if((B[0] != B[1]) and (B[1] != B[2]) and (B[0] != B[2])){
                if((ma2 == B[1]) or (mi2 == B[1])) cnt++;
            }
        }
        cout << cnt << endl;
    }else cout << "INF" << endl;


    return 0;
}
0