結果

問題 No.8023 素数判定するだけ
ユーザー mmn15277198
提出日時 2020-06-07 09:48:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 800 ms
コンパイル使用メモリ 98,436 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-23 16:19:15
合計ジャッジ時間 4,622 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<math.h>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<deque>
#include<map>
using namespace std;

void solv(){
	int n;
	cin >> n;
	int i=n;
	vector<int> v;
	while(i--){
		v.push_back(i);
	}
	sort(v.begin(),v.end());
	v.erase(v.begin());
	if(v.empty()){
		cout << "NO" << endl;
		return;
	}
	v.erase(v.begin());
	if(v.empty()){
		cout << "YES" << endl;
		return;
	}
	
	for(auto &x:v){
		int a=n/x;
		int b=n%x;
		if((a-b)==a){
			cout << "NO" << endl;
			return;
		}
	}
	cout << "YES" << endl;
	return;
}

int main(){
	solv();
}

0