結果

問題 No.7 プライムナンバーゲーム
ユーザー memmemmimemmemmi
提出日時 2018-06-22 19:03:59
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 943 bytes
コンパイル時間 738 ms
コンパイル使用メモリ 91,972 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-13 08:03:39
合計ジャッジ時間 1,694 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 2 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,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <iomanip>
using namespace std;
#define INF 1e9
#define PI acos(-1)
typedef long long ll;


bool result[10000] = { false };

bool is_prime(int n) {
	for (int i = 2; i*i <= n; i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


int main() {
	int n; cin >> n;

	vector<int> prime;
	for (int i = 2; i <= 10000; i++) {
		if (is_prime(i))prime.push_back(i);
	}

		for (auto itr = prime.begin(); itr < prime.end(); itr++) {
			if (2 + *itr <= n) {
				result[2 + *itr] = true;
			}
			if (3 + *itr <= n) {
				result[3 + *itr] = true;
			}

		}
	cout << ((result[n])?"Win" : "Lose") << endl;

	return 0;
}
0