結果

問題 No.36 素数が嫌い!
ユーザー zaichuzaichu
提出日時 2015-12-30 00:29:08
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 643 ms / 5,000 ms
コード長 762 bytes
コンパイル時間 2,752 ms
コンパイル使用メモリ 150,824 KB
実行使用メモリ 78,376 KB
最終ジャッジ日時 2023-09-09 07:27:26
合計ジャッジ時間 9,872 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 232 ms
38,192 KB
testcase_01 AC 462 ms
61,576 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 3 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 154 ms
27,552 KB
testcase_12 AC 643 ms
78,376 KB
testcase_13 AC 615 ms
78,188 KB
testcase_14 AC 347 ms
49,820 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 203 ms
32,476 KB
testcase_20 AC 626 ms
78,172 KB
testcase_21 AC 447 ms
60,692 KB
testcase_22 AC 461 ms
62,636 KB
testcase_23 AC 258 ms
38,580 KB
testcase_24 AC 291 ms
42,748 KB
testcase_25 AC 292 ms
41,912 KB
testcase_26 AC 370 ms
48,932 KB
testcase_27 AC 542 ms
67,792 KB
testcase_28 AC 354 ms
47,880 KB
testcase_29 AC 625 ms
75,944 KB
権限があれば一括ダウンロードができます

ソースコード

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] == 0){
			n /= data[i];
			count++;
		}
	}
	if(n > 1) 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