結果

問題 No.7 プライムナンバーゲーム
ユーザー tinumukiti631tinumukiti631
提出日時 2016-11-07 00:42:56
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 643 bytes
コンパイル時間 1,210 ms
コンパイル使用メモリ 146,012 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-08-16 14:07:24
合計ジャッジ時間 7,839 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,488 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
int main(){
  bool flag[10001] = {0};
  vector<int>table;
  for(int i = 2;i <= 10000;i++){
    if(flag[i] == true)continue;
    table.pb(i);
    for(int j = i;j <= 10000;j += i)flag[j] = true;
  }
  int N;
  cin >> N;
  int cnt = 0;
  bool flug = false;
  while(1){
    int i;
    for(i = 0;i < table.size();i++){
      if(table[i] >= N)break;
    }
    while(table[i] + 1 >= N){
      i--;
      if(!~i){
	flug = true;
	break;
      }
    }
    if(flug)break;
    N -= table[i];
    cnt++;
  }
  if(cnt % 2)cout << "Win" << endl;
  else cout << "Lose" << endl;
  return 0;
}
0