結果

問題 No.358 も~っと!門松列
ユーザー けーむけーむ
提出日時 2020-02-26 13:20:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 1,122 bytes
コンパイル時間 1,679 ms
コンパイル使用メモリ 168,456 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 16:21:07
合計ジャッジ時間 2,584 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

bool f(ll a1, ll a2, ll a3) {
    if ((a1 == a2) || (a2 == a3) || (a1 == a3)) {
        return false;
    }
    vector<ll> v(3);
    v[0] = a1; v[1] = a2; v[2] = a3;
    sort(all(v));
    return ((v[0] == a2) || (v[2] == a2));
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll a1, a2, a3;
    cin >> a1 >> a2 >> a3;
    if (a1 > a3) swap(a1, a3);
    if (f(a1, a2, a3)) {
        cout << "INF" << endl;
        return 0;
    }
    ll ans = 0;
    reps(i, 1, 1001) {
        ll b1 = a1 % i;
        ll b2 = a2 % i;
        ll b3 = a3 % i;
        if (f(b1, b2, b3)) ans++;
    }
    cout << ans << endl;
    return 0;
}
0