結果

問題 No.36 素数が嫌い!
ユーザー zaichuzaichu
提出日時 2015-12-30 00:27:18
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 1,465 ms
コンパイル使用メモリ 166,684 KB
実行使用メモリ 78,540 KB
最終ジャッジ日時 2023-10-19 12:30:06
合計ジャッジ時間 10,528 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 489 ms
61,992 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 3 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 164 ms
27,704 KB
testcase_12 AC 638 ms
78,540 KB
testcase_13 AC 638 ms
78,344 KB
testcase_14 AC 386 ms
49,924 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 328 ms
42,804 KB
testcase_25 WA -
testcase_26 AC 395 ms
48,936 KB
testcase_27 AC 544 ms
67,860 KB
testcase_28 AC 365 ms
47,880 KB
testcase_29 AC 637 ms
76,036 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++;
		}
	}
	//	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