結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-12 21:15:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 108 ms / 5,000 ms |
| コード長 | 708 bytes |
| コンパイル時間 | 665 ms |
| コンパイル使用メモリ | 74,832 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 00:55:55 |
| 合計ジャッジ時間 | 2,589 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
#include <iostream>
#include <sstream>
#include <vector>
#include <array>
#include <string>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;
#define REP(i,first,last) for (int i=first;i<last;++i)
#define MAX(x,y) (x > y ? x : y)
#define MIN(x,y) (x < y ? x : y)
long N;
vector<int> factor(long n){
vector<int> res;
int num = 2;
int sqrt_n = sqrt(n);
while (true) {
if (n == 1) break;
if (num > sqrt_n) {
res.push_back(n);
break;
}
while (n % num == 0) {
n /= num;
res.push_back(num);
}
++num;
}
return res;
}
int main(){
cin >> N;
vector<int> res = factor(N);
cout << (res.size() > 2 ? "YES" : "NO") << endl;
}