結果

問題 No.36 素数が嫌い!
ユーザー hitoyozakehitoyozake
提出日時 2018-11-24 13:19:44
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 297 ms / 5,000 ms
コード長 848 bytes
コンパイル時間 545 ms
コンパイル使用メモリ 65,548 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 04:52:48
合計ジャッジ時間 2,971 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
4,376 KB
testcase_01 AC 59 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 34 ms
4,376 KB
testcase_12 AC 102 ms
4,380 KB
testcase_13 AC 297 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 39 ms
4,376 KB
testcase_20 AC 96 ms
4,376 KB
testcase_21 AC 74 ms
4,376 KB
testcase_22 AC 76 ms
4,380 KB
testcase_23 AC 48 ms
4,380 KB
testcase_24 AC 31 ms
4,376 KB
testcase_25 AC 53 ms
4,380 KB
testcase_26 AC 60 ms
4,380 KB
testcase_27 AC 86 ms
4,380 KB
testcase_28 AC 62 ms
4,380 KB
testcase_29 AC 93 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <map>
#include <cmath>
using i64 = long long;

int main()
{

    i64 n = 0;
    std::cin >> n;
    bool flag = false;
    const i64 max = 100000000000000;

    const i64 goal = i64(std::sqrt(n));
    int counter = 0;
    for( i64 i = 2; i <= goal; ++i){
        //std::cout << i << std::endl;
        if(n%i==0)
        {
            ++counter;
            if(counter>=3)
            {
                flag = true;
                break;
            }
            //std::cout << "i: " << i << std::endl;
            n /= i;
            i = 1;
            //std::cout << n << std::endl;
        }
    }

    if(n!=1)
        ++counter;

    if(counter>=3)
        flag=true;
    if(flag==false)
        std::cout << "NO" << std::endl;
    else
        std::cout << "YES" << std::endl;

    return 0;
}
0