結果

問題 No.358 も~っと!門松列
ユーザー h_nosonh_noson
提出日時 2016-04-17 22:40:56
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 750 bytes
コンパイル時間 393 ms
コンパイル使用メモリ 60,720 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-15 02:20:46
合計ジャッジ時間 1,001 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 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 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 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 1 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define RREP(i,s,e) for (i = s; i >= e; i--)
#define rrep(i,n) RREP(i,n,0)
#define REP(i,s,e) for (i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
#define INF 100000000

typedef long long ll;

int main() {
    int i;
    int a[3];
    rep (i,3) cin >> a[i];
    if (a[0] == a[2])
        cout << 0 << endl;
    else if (a[1] < min(a[0],a[2]) || a[1] > max(a[0],a[2]))
        cout << "INF" << endl;
    else {
        int cnt = 0;
        REP (i,2,*max_element(a,a+3)+1) {
            if (a[0]%i != a[2]%i && (a[1]%i < min(a[0]%i,a[2]%i) || a[1]%i > max(a[0]%i,a[2]%i))) {
                cnt++;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}
0