結果

問題 No.36 素数が嫌い!
ユーザー hogeover30
提出日時 2015-02-04 02:14:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 105 ms / 5,000 ms
コード長 466 bytes
コンパイル時間 561 ms
コンパイル使用メモリ 69,848 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 00:15:10
合計ジャッジ時間 1,834 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
typedef long long ll;

string func(ll n)
{
    if (n==1) return "NO";
    unordered_map<int, int> f;
    for(ll i=2;i*i<=n;++i) {
        int c=0;
        while (n%i==0) { c++; n/=i; }
        if (c) f[i]+=c;
    }
    if (n>1) f[n]++;
    int cnt=0;
    for(auto& v: f) cnt+=v.second;
    return cnt>2?"YES":"NO";
}
int main()
{
    ll n;
    while (cin>>n) cout<<func(n)<<endl;
}
0