結果

問題 No.36 素数が嫌い!
ユーザー kkslucy1
提出日時 2018-03-10 23:14:32
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
実行時間 -
コード長 459 bytes
コンパイル時間 1,299 ms
コンパイル使用メモリ 160,188 KB
実行使用メモリ 108,344 KB
最終ジャッジ日時 2024-10-14 17:59:59
合計ジャッジ時間 8,472 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other AC * 3 RE * 2 TLE * 1 -- * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	ll n;
	cin >> n;
	int count = 0;
	vector<bool> p(n);
	for (ll i = 0;i < n;i++) {
		p[i] = false;
	}
	ll i = 2;
	while(i<n) {
		if (!p[i]) {
			for (ll j = 1;i*j < n;j++) {
				p[i*j] = true;
			}
			while (n%i == 0&&i<n) {
				n /= i;
				count++;
				if (count == 2) {
					cout << "YES" << endl;
					return 0;
				}
			}
		}
		i++;
	}
	cout << "NO" << endl;



	return 0;
}
0