結果

問題 No.358 も~っと!門松列
ユーザー yukiteruyukiteru
提出日時 2018-02-08 10:19:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 1,111 bytes
コンパイル時間 1,010 ms
コンパイル使用メモリ 82,508 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 02:22:01
合計ジャッジ時間 1,695 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>
#include<list>
#include<bitset>
#include<functional>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265358979

using namespace std;
typedef pair<int, int> P;

int main(void) {
	int a[4];
	int max = 0;
	int min = INF;
	int count = 0;

	FOR(i, 1, 3) {
		cin >> a[i];
		if (a[i] > max) {
			max = a[i];
		}
		if (a[i] < min) {
			min = a[i];
		}
	}

	if (a[1] == a[2] || a[2] == a[3] || a[3] == a[1]) {
		cout << 0 << endl;
	}
	else if (max == a[2] || min == a[2]) {
		cout << "INF" << endl;
	}
	else {
		FOR(i, 1, max) {
			int b[4];
			b[1] = a[1] % i;
			b[2] = a[2] % i;
			b[3] = a[3] % i;
			if (b[1] != b[2] && b[2] != b[3] && b[3] != b[1]) {
				if (b[2] > b[1] && b[2] > b[3]) {
					count++;
				}
				else if (b[2] < b[1] && b[2] < b[3]) {
					count++;
				}
			}
		}
		cout << count << endl;
	}
	

	
	return 0;
}
0