結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
tenkyu9
|
| 提出日時 | 2018-04-03 03:22:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 732 bytes |
| コンパイル時間 | 799 ms |
| コンパイル使用メモリ | 80,876 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 07:02:19 |
| 合計ジャッジ時間 | 1,300 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 10 |
ソースコード
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<climits>
#include<set>
#include<utility>
using namespace std;
typedef long long int ll;
int main(){
int n;
cin >> n;
bool flag[10100];
memset(flag, 1, 10100);
int num=2;
while(num<110){
if(flag[num]){
for(int i=2; i<10100/num; i++){
flag[num*i]=false;
}
}
num++;
}
bool dp[10001]={false};
dp[0]=dp[1]=true;
for(int i=2; i<=n; i++){
for(int j=2; j<=i; i++){
if(flag[j]){
if(i-j>=2 && !dp[i-j]){
dp[i]=true;
break;
}
}
}
}
if(dp[n]){
cout << "Win" << endl;
} else {
cout << "Lose" << endl;
}
return 0;
}
tenkyu9