結果

問題 No.36 素数が嫌い!
ユーザー Kuphony
提出日時 2016-03-18 22:30:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 100 ms / 5,000 ms
コード長 634 bytes
コンパイル時間 499 ms
コンパイル使用メモリ 64,952 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 00:43:03
合計ジャッジ時間 1,840 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 99999999;
using namespace std;

int factorCount(long long N){
    int count = 0;
    for (long long i = 2; i*i < N; i++) {
        while (N%i == 0) {
            N /= i;
            count++;
        }
    }
    if(N != 1)count++;
    return count;
}

int main(int argc, const char * argv[]) {
    long long N;
    cin >> N;
    //素数,1,それ自身以外で割り切れるかどうか判定
    //
    if(factorCount(N)<3)cout << "NO" << endl;
    else cout << "YES" << endl;
}
0