結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-09-19 00:50:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 367 bytes |
| コンパイル時間 | 680 ms |
| コンパイル使用メモリ | 64,256 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-08 02:43:45 |
| 合計ジャッジ時間 | 4,165 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 9 WA * 8 |
ソースコード
#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;
}