結果

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int count = 0;
	if((a == b)||(a == c)||(b == c)) {
		cout << "0" << endl;
		return 0;
	}
	if(b == max({a, b,c})||(b == min({a, b, c}))) {
		cout << "INF" << endl;
		return 0;
	} else {
		for(int i = 2; i <= max({a, b, c}); i++) {
			int a1, b1, c1;
			a1 = a % i;
			b1 = b % i;
			c1 = c % i;
			if((a1 != b1)&&(a1 != c1)&&(b1 != c1)) {
				if((b1 == max({a1, b1, c1}))||(b1 == min({a1, b1, c1}))) {
					count++;
				}
			}
		}
	}
	cout << count << endl;

	return 0;
}
0