結果

問題 No.36 素数が嫌い!
ユーザー tadanoningen
提出日時 2020-09-29 23:52:07
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 96 ms / 5,000 ms
コード長 380 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 63,360 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-04 18:49:04
合計ジャッジ時間 1,780 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#define ll long long

using namespace std;

ll is_prime(ll n){
    ll ans = 0;
    for(ll i=2;i*i <= n;i++){
        while(n % i == 0){
            ans++;
            n /= i;
        }
    }
    if(n != 1) ans++;
    return ans;
}

int main(){
    ll n;
    cin >> n;
    if(is_prime(n) < 3) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}
0