結果

問題 No.36 素数が嫌い!
ユーザー zaichu
提出日時 2015-12-30 00:21:53
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 737 bytes
コンパイル時間 2,249 ms
コンパイル使用メモリ 164,820 KB
実行使用メモリ 78,720 KB
最終ジャッジ日時 2024-09-19 08:34:25
合計ジャッジ時間 12,483 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 16 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int check(long long int n){
	vector<long long int> data(sqrt(n)+1);
	for(int i = 2; i <= sqrt(n); i++) data[i] = i;
	for(int i = 2; i <= sqrt(n); i++){
		if(data[i]){
			for(int j = 0; i * (j + 2) <= sqrt(n); j++){
				data[i*(j + 2)] = 0;
			}
		}
	}
	sort(data.begin(),data.end());
	data.erase(unique(data.begin(),data.end()),data.end());
	data.erase(data.begin());
	//	for(auto a:data) cout << a << endl;
	int count = 0;
	for(int i = 0; i < data.size(); i++){
		while(n % data[i]){
			n /= data[i];
			count++;
		}
	}
	//	cout << count << endl;
	return count;
}

int main(){
	long long int n;
	cin >> n;
	if(check(n) >= 3) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}
0