結果

問題 No.36 素数が嫌い!
ユーザー なお
提出日時 2014-10-08 00:58:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 54 ms / 5,000 ms
コード長 496 bytes
コンパイル時間 579 ms
コンパイル使用メモリ 54,484 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 00:11:42
合計ジャッジ時間 2,175 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
typedef long long ll;
#define REP(i, n)           for(int(i)=0;(i)<(n);++(i))

const int MAX = 10000100;

int pdecomp(ll n){
    unsigned int e = 0;
    while(n % 2 == 0){ n /= 2, e++; }
    for(unsigned int p = 3; p < MAX && p*p <= n; p += 2){
        while(n % p == 0){ n /= p, e++; }
    }
    if(n != 1) e++;
    return e;
}

int main(){
    ll N;
    cin >> N;
    cout << (pdecomp(N) > 2 ?"YES":"NO") << endl;
    return 0;
}
0