結果

問題 No.7 プライムナンバーゲーム
ユーザー kotatsugamekotatsugame
提出日時 2017-09-19 00:50:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 367 bytes
コンパイル時間 750 ms
コンパイル使用メモリ 64,984 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 15:38:42
合計ジャッジ時間 4,221 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<iostream>
using namespace std;
bool dp[10001];int p[10001],c;
int main()
{
	for(int i=2;i<=10000;i++)
	{
		bool flag=true;
		for(int j=2;j<i;j++)
		{
			flag&=i%j;
		}
		if(flag)p[c++]=i;
	}
	for(int i=2;i<=10000;i++)
	{
		bool flag=false;
		for(int j=0;j<c&&i-p[j]>=0;j++)flag|=!dp[i-p[j]];
		dp[i]=flag;
	}
	int n;cin>>n;cout<<(dp[n]?"Lose":"Win")<<endl;
}
0