結果
| 問題 |
No.36 素数が嫌い!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-12 21:10:33 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 108 ms / 5,000 ms |
| コード長 | 679 bytes |
| コンパイル時間 | 814 ms |
| コンパイル使用メモリ | 74,916 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-27 00:55:49 |
| 合計ジャッジ時間 | 2,731 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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 (n > 1) {
while (n % num == 0) {
n /= num;
res.push_back(num);
}
++num;
if (num > sqrt_n) break;
}
if (n != 1) res.push_back(n);
return res;
}
int main(){
cin >> N;
vector<int> res = factor(N);
cout << (res.size() > 2 ? "YES" : "NO") << endl;
}