結果

問題 No.36 素数が嫌い!
ユーザー ふーらくたる
提出日時 2016-07-29 01:09:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 110 ms / 5,000 ms
コード長 735 bytes
コンパイル時間 916 ms
コンパイル使用メモリ 66,548 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-27 00:47:54
合計ジャッジ時間 1,991 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;

typedef long long ll;

map<ll, int> PrimeFactorization(ll number) {
    map<ll, int> res;
    for (ll n = 2; n * n <= number; n++) {
        while (number % n == 0) {
            res[n]++;
            number /= n;
        }
    }
    if (number != 1) res[number]++;
    return res;
}

int main() {
    ll N;
    cin >> N;

    map<ll, int> factors = PrimeFactorization(N);

    int divisor_num = 1, size;
    for (auto it = factors.begin(); it != factors.end(); it++) {
        divisor_num *= it->second + 1;
    }
    size = factors.size();

    if (divisor_num - size - 2 > 0) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}
0