結果

問題 No.7 プライムナンバーゲーム
ユーザー shisyamokongarishisyamokongari
提出日時 2016-08-22 01:15:19
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 501 bytes
コンパイル時間 537 ms
コンパイル使用メモリ 63,724 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-07 17:35:42
合計ジャッジ時間 1,434 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<iostream>
#include<vector>
#include<cmath>

using namespace std;

#define NMAX 10000

int main(){

	vector<int> sosuu;
	int hurui[NMAX+1];
	int K,N;

	for(int i=0;i<=NMAX;i++) hurui[i]=0;
	hurui[0]=1,hurui[1]=1;

	for(int i=0;i<=NMAX;i++){
		if(hurui[i]==0){
			sosuu.push_back(i);
			for(int j=i*2;j<NMAX;j+=i) hurui[j]=1;
		}
	}

	cin>>N;
	bool f=false;
	for(int i=0;i<sosuu.size();i++){
		if(N-sosuu[i]==2||N-sosuu[i]==3) f=true;
	}

	if(f) cout<<"Win"<<endl;
	else cout<<"Lose"<<endl;
}

0