結果

問題 No.358 も~っと!門松列
ユーザー oooooba
提出日時 2021-02-11 10:44:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 872 bytes
コンパイル時間 900 ms
コンパイル使用メモリ 105,500 KB
最終ジャッジ日時 2025-01-18 17:20:00
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

bool f(vector<int32_t> &as) {
    return (as[1] > as[0] && as[1] > as[2] && as[0] != as[2]) ||
           (as[1] < as[0] && as[1] < as[2] && as[0] != as[2]);
}

int main() {
    vector<int32_t> as(3);
    for (auto i = 0; i < 3; ++i) {
        cin >> as[i];
    }
    if (f(as)) {
        cout << "INF" << endl;
        return 0;
    }
    int32_t ans = 0;
    for (auto i = 1, e = *max_element(as.begin(), as.end()); i <= e; ++i) {
        vector<int32_t> as2(3);
        for (auto j = 0; j < 3; ++j) {
            as2[j] = as[j] % i;
        }
        if (f(as2))
            ++ans;
    }
    cout << ans << endl;
    return 0;
}
0