結果

問題 No.358 も~っと!門松列
ユーザー umaumax
提出日時 2017-05-01 21:51:05
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 642 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 59,340 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 02:13:33
合計ジャッジ時間 1,331 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>

using namespace std;

int main(int argc, const char* argv[])
{
	int A[3];
	cin >> A[0] >> A[1] >> A[2];

	{
		int _A[3] = {A[0], A[1], A[2]};
		sort(&_A[0], &_A[2 + 1]);
		if (_A[0] == _A[1]) {
			cout << 0 << endl;
			return 0;
		}
	}

	if (A[1] < A[0] && A[1] < A[2] || A[1] > A[0] && A[1] > A[2]) {
		cout << "INF" << endl;
		return 0;
	}

	int cnt = 0;
	int p   = 1;
	while (p <= 1001) {
		if (A[0] % p != A[1] % p && A[0] % p != A[2] % p && (A[1] % p < A[0] % p && A[1] % p < A[2] % p || A[1] % p > A[0] % p && A[1] % p > A[2] % p)) {
			cnt++;
		}
		p++;
	}

	cout << cnt << endl;
	return 0;
}
0