結果

問題 No.36 素数が嫌い!
コンテスト
ユーザー なお
提出日時 2014-10-08 01:11:23
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 50 ms / 5,000 ms
コード長 446 bytes
コンパイル時間 454 ms
コンパイル使用メモリ 55,076 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 00:11:44
合計ジャッジ時間 1,564 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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))

int pdecomp(ll n){
    unsigned int e = 0;
    while(n % 2 == 0){ n /= 2, e++; }
    for(ll p = 3; 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