結果

問題 No.7 プライムナンバーゲーム
ユーザー tenkyu9tenkyu9
提出日時 2018-04-03 03:03:37
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 720 bytes
コンパイル時間 558 ms
コンパイル使用メモリ 76,044 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-08 13:55:41
合計ジャッジ時間 1,496 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#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 flg=true;
	for(int i=2; i<10001; i++){
		if(flag[i]){
			if(n-i>3){
				for(int j=2; j<10001; j++){
					if(n-i==j+3 && flag[j]){
						flg=false;
					}
				}
			}
		}
	}
	if(flg){
		cout << "Win" << endl;
	} else {
		cout << "Lose" << endl;
	}

	return 0;
}
0