結果
問題 |
No.7 プライムナンバーゲーム
|
ユーザー |
|
提出日時 | 2017-09-19 00:58:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 386 bytes |
コンパイル時間 | 515 ms |
コンパイル使用メモリ | 64,628 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-08 02:43:52 |
合計ジャッジ時間 | 3,922 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 WA * 7 |
ソースコード
#include<iostream> using namespace std; bool dp[10001];int p[10001],c; int main() { dp[0]=dp[1]=true; 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]?"Win":"Lose")<<endl; }