結果

問題 No.7 プライムナンバーゲーム
ユーザー dgd1724dgd1724
提出日時 2016-11-22 19:51:39
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 854 bytes
コンパイル時間 1,234 ms
コンパイル使用メモリ 143,968 KB
実行使用メモリ 4,504 KB
最終ジャッジ日時 2023-08-18 06:18:37
合計ジャッジ時間 2,706 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

//const static double	de_PI	= 3.14159265358979323846;
//const static double	de_EPS	= 0.000001;
//const static int	de_MOD = 1000000007;
//const static int	de_MAX = 999999999;
//const static int	de_MIN = -999999999;

inline bool Judge_PrimeNumber(const int &a) {

	if (a < 2) { return false; }
	if (a == 2 || a == 3) { return true; }
	if (a % 2 == 0) { return false; }
	if (a % 6 != 1 && a % 6 != 5) { return false; }

	for (int i = 5; i <= a / i; i += 2) {
		if (a%i == 0) { return false; }
	}

	return true;
}

int main(void) {

	//std::ifstream inf("123.txt");	std::cin.rdbuf(inf.rdbuf());

	int N = 0;
	std::cin >> N;

	if (Judge_PrimeNumber(N - 2)) {
		std::cout << "Win" << std::endl;
		return 0;
	}

	if (Judge_PrimeNumber(N - 3)) {
		std::cout << "Win" << std::endl;
		return 0;
	}

	std::cout << "Lose" << std::endl;

}

0