結果

問題 No.358 も~っと!門松列
ユーザー hiragn
提出日時 2019-07-19 04:17:50
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 536 bytes
コンパイル時間 1,773 ms
コンパイル使用メモリ 166,536 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-25 23:54:37
合計ジャッジ時間 2,874 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 || b == c || c == a) {
        return false;
    } else {
        return (max({a, b, c}) == b || min({a, b, c}) == b);
    }
}

int main() {
    int a, b, c;
    cin >> a >> b >> c;

    if (isKadomatsu(a, b, c)) {
        cout << "INF" << endl;
        return 0;
    }

    int ans = 0;
    for (int i = 2; i <= max({a, b, c}); ++i) {
        ans += isKadomatsu(a % i, b % i, c % i);
    }

    cout << ans << endl;
    return 0;
}
0