結果
問題 |
No.7 プライムナンバーゲーム
|
ユーザー |
|
提出日時 | 2020-02-11 13:25:50 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 682 bytes |
コンパイル時間 | 1,456 ms |
コンパイル使用メモリ | 169,580 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-01 07:18:08 |
合計ジャッジ時間 | 5,291 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 RE * 14 |
ソースコード
#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;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; } }