結果
問題 |
No.36 素数が嫌い!
|
ユーザー |
|
提出日時 | 2017-02-12 21:00:04 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 677 bytes |
コンパイル時間 | 878 ms |
コンパイル使用メモリ | 74,552 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-29 16:57:07 |
合計ジャッジ時間 | 1,895 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 WA * 11 |
ソースコード
#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) int N; vector<int> factor(int 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; }