結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,504 KB
testcase_01 AC 2 ms
4,376 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;
  while(1){
    int i;
    if(N <= 3)break;
    for(i = 0;i < table.size();i++){
      if(table[i] >= N)break;
    }
    while(table[i] + 1 >= N)i--;
    N -= table[i];
    cnt++;
  }
  if(cnt % 2)cout << "Win" << endl;
  else cout << "Lose" << endl;
  return 0;
}
0