結果

問題 No.358 も~っと!門松列
ユーザー lmxyue
提出日時 2025-08-25 15:57:24
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 13 ms / 1,000 ms
コード長 598 bytes
コンパイル時間 2,054 ms
コンパイル使用メモリ 193,432 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-25 15:57:27
合計ジャッジ時間 3,316 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

bool isKadomatsu(long long x, long long y, long long z) {
        if (x == y || y == z || x == z) return false;
        if (x > y && y < z) return true;
        if (x < y && y > z) return true;
        return false;
}

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

        int ans = 0;
        for (int i = 1; i <= 1000000; i++) {
                if (isKadomatsu(a % i, b % i, c % i)) ans++;
        }
        if (ans >= 10000) {
                cout << "INF" << endl;
        } else {
                cout << ans << endl;
        }
}
0