結果

問題 No.36 素数が嫌い!
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2018-01-08 00:37:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 269 ms / 5,000 ms
コード長 942 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 73,480 KB
実行使用メモリ 42,628 KB
最終ジャッジ日時 2023-09-09 08:10:31
合計ジャッジ時間 9,592 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 257 ms
42,404 KB
testcase_01 AC 246 ms
42,496 KB
testcase_02 AC 242 ms
42,368 KB
testcase_03 AC 243 ms
42,396 KB
testcase_04 AC 234 ms
42,404 KB
testcase_05 AC 243 ms
42,480 KB
testcase_06 AC 249 ms
42,608 KB
testcase_07 AC 245 ms
42,464 KB
testcase_08 AC 257 ms
42,528 KB
testcase_09 AC 239 ms
42,368 KB
testcase_10 AC 243 ms
42,400 KB
testcase_11 AC 235 ms
42,384 KB
testcase_12 AC 255 ms
42,408 KB
testcase_13 AC 257 ms
42,388 KB
testcase_14 AC 257 ms
42,392 KB
testcase_15 AC 248 ms
42,392 KB
testcase_16 AC 248 ms
42,388 KB
testcase_17 AC 269 ms
42,616 KB
testcase_18 AC 261 ms
42,628 KB
testcase_19 AC 259 ms
42,368 KB
testcase_20 AC 243 ms
42,528 KB
testcase_21 AC 267 ms
42,368 KB
testcase_22 AC 239 ms
42,448 KB
testcase_23 AC 260 ms
42,404 KB
testcase_24 AC 251 ms
42,396 KB
testcase_25 AC 256 ms
42,388 KB
testcase_26 AC 242 ms
42,388 KB
testcase_27 AC 250 ms
42,368 KB
testcase_28 AC 250 ms
42,556 KB
testcase_29 AC 255 ms
42,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;


    int p[10000001] = {0};
    

int main() {
    
    long long N;
    cin >> N;
    
    for ( int i = 2; i <= 10000000; i++ ) {
        if ( !p[i] ) {
            long long j = i*2;
            while ( j <= 10000000 ) {
                p[j] = 1;
                j += i;
            }
        }
    }
    
    bool ans = false;
    int a = 0;
    for ( int i = 2; i <= 10000000; i++ ) {
        if ( !p[i] ) {            
            while ( !(N%i) ) {
                N /= i;
                a++;
            }
        }
    }
    
    ans = ( a == 2 && N != 1 ) || a >= 3;
    
    cout << ( ans ? "YES" : "NO" ) << endl;
    
    
    return 0;
}
0