結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
tkm2261
|
| 提出日時 | 2017-07-03 23:44:54 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 865 bytes |
| コンパイル時間 | 1,309 ms |
| コンパイル使用メモリ | 161,528 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-05 12:54:15 |
| 合計ジャッジ時間 | 2,093 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 17 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define UNIQUE(v) (v).erase(unique(ALL(v)), (v).end())
#define MP make_pair
#define MT make_tuple
int arr[10010];
int dp[10001];
int N, t, s = 0;
void Eratosthenes(){
for(int i = 0; i < N; i++){
arr[i] = 1;
}
for(int i = 2; i < sqrt(N); i++){
if(arr[i]){
for(int j = 0; i * (j + 2) < N; j++){
arr[i *(j + 2)] = 0;
}
}
}
}
int main(){
cin >> N;
Eratosthenes();
dp[0] = dp[1] = 1;
FOR(i, 2, N + 1){
FOR(j, 2, N) {
if(j > i) break;
if(dp[i - j]==0 && arr[j]){ dp[i] = 1; break; }
}
}
cout << dp[N] << endl;
string s = dp[N]?"Win":"Lose";
cout << s << endl;
}
tkm2261