結果

問題 No.36 素数が嫌い!
ユーザー goodbatongoodbaton
提出日時 2015-07-29 23:34:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 104 ms / 5,000 ms
コード長 1,082 bytes
コンパイル時間 549 ms
コンパイル使用メモリ 75,312 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-09 07:14:28
合計ジャッジ時間 3,033 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
4,380 KB
testcase_01 AC 82 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,500 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 35 ms
4,376 KB
testcase_12 AC 104 ms
4,376 KB
testcase_13 AC 104 ms
4,376 KB
testcase_14 AC 65 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 42 ms
4,376 KB
testcase_20 AC 104 ms
4,380 KB
testcase_21 AC 80 ms
4,376 KB
testcase_22 AC 83 ms
4,380 KB
testcase_23 AC 50 ms
4,376 KB
testcase_24 AC 55 ms
4,380 KB
testcase_25 AC 55 ms
4,380 KB
testcase_26 AC 99 ms
4,376 KB
testcase_27 AC 91 ms
4,380 KB
testcase_28 AC 97 ms
4,376 KB
testcase_29 AC 101 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cstring>

typedef long long ll;
using namespace std;

#define mod 1000003
#define INF 10000000
#define LLINF 2000000000000000000LL

#define SIZE 100000

vector<ll> factor(ll n){
    vector<ll> ret,ret2;
    
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            ret.push_back(i);
            
            if(i*i<n)
                ret2.push_back(n/i);
        }
    }
    
    for(ll i=0;i<ret2.size();i++){
        ret.push_back(ret2[ret2.size()-1-i]);
    }
    
    return ret;
}

int main(){
    ll n;
    vector<ll> fac;
    
    cin >> n;
    
    fac = factor(n);
    
    for(int i=1;i<fac.size()-1;i++){
        bool f = false;
        
        for(ll j=2;j*j<=fac[i];j++){
            if(fac[i]%j==0)
                f = true;
        }
        
        if(f){
            puts("YES");
            return 0;
        }
    }
    
    puts("NO");
    return 0;
}
0