結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-02-11 13:26:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 121 ms / 5,000 ms |
| コード長 | 684 bytes |
| コンパイル時間 | 1,572 ms |
| コンパイル使用メモリ | 169,440 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-01 16:30:48 |
| 合計ジャッジ時間 | 2,946 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 17 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;cin >> n;
vector<bool> p(n,true),w(n);
p[0]=false;
p[1]=false;
for(int i=2;i*i<=n;i++){
if(p[i]){
for(int j=2;j*i<=n;j++){
p[i*j]=false;
}
}
}
w[0]=true;
w[1]=true;
for(int i=0;i<=n;i++){
for(int j=0;i+j<=n;j++){
if(p[j]){
if(w[i]){
w[i+j]=(w[i+j]|0);
}
else{
w[i+j]=true;
}
}
}
}
if(w[n]){
cout << "Win" << endl;
}
else{
cout << "Lose" << endl;
}
}