結果

問題 No.358 も~っと!門松列
ユーザー hotpepsi
提出日時 2016-04-25 00:35:43
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 418 bytes
コンパイル時間 418 ms
コンパイル使用メモリ 57,448 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-04 15:40:31
合計ジャッジ時間 1,140 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <sstream>

using namespace std;

int main(int argc, char *argv[])
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a != c && ((b > a && b > c) || (b < a && b < c))) {
		cout << "INF" << endl;
	} else {
		int ans = 0;
		for (int p = 2; p <= 1000; ++p) {
			int x = a % p, y = b % p, z = c % p;
			ans += x != z && ((y > x && y > z) || (y < x && y < z));
		}
		cout << ans << endl;
	}
	return 0;
}
0