結果

問題 No.358 も~っと!門松列
ユーザー BwambocosBwambocos
提出日時 2017-06-17 16:37:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 664 bytes
コンパイル時間 1,594 ms
コンパイル使用メモリ 167,144 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-04-08 20:28:28
合計ジャッジ時間 2,554 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int A1, A2, A3;
int ans;

int main()
{
	in >> A1 >> A2 >> A3;
	if (A1 > A2 && A2 < A3) { out << "INF" << std::endl; }
	else
	{
		auto max = std::max(A1, std::max(A2, A3));
		for (int i = 1; i <= max; ++i)
		{
			auto A1_res = A1%i;
			auto A2_res = A2%i;
			auto A3_res = A3%i;
			if ((A1_res != A2_res&&A2_res != A3_res&&A1_res != A3_res) &&
				((A1_res > A2_res&&A2_res < A3_res) || (A1_res<A2_res&&A2_res>A3_res)))
			{
				++ans;
			}
		}
		out << ans << std::endl;
	}
	return 0;
}
0