結果

問題 No.36 素数が嫌い!
ユーザー mencotton
提出日時 2020-02-14 14:31:53
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 105 ms / 5,000 ms
コード長 509 bytes
コンパイル時間 803 ms
コンパイル使用メモリ 75,792 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-06 07:55:05
合計ジャッジ時間 2,253 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>

using namespace std;

map<int64_t, int> prime_factor(int64_t n) {
    map<int64_t, int> ret;
    for (int64_t i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

int main() {
    long long n;
    cin >> n;

    auto ma = prime_factor(n);
    long long count = 0;
    for (auto x:ma)count += x.second;

    cout << (count > 2 ? "YES" : "NO") << endl;
    return 0;
}
0