結果

問題 No.36 素数が嫌い!
ユーザー kpinkcatkpinkcat
提出日時 2023-10-09 03:39:21
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 815 bytes
コンパイル時間 1,164 ms
コンパイル使用メモリ 106,636 KB
実行使用メモリ 81,340 KB
最終ジャッジ日時 2023-10-09 03:39:31
合計ジャッジ時間 9,747 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
81,176 KB
testcase_01 AC 311 ms
81,008 KB
testcase_02 AC 383 ms
81,176 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 391 ms
81,060 KB
testcase_06 WA -
testcase_07 AC 363 ms
81,004 KB
testcase_08 AC 58 ms
81,180 KB
testcase_09 AC 40 ms
81,052 KB
testcase_10 AC 102 ms
81,048 KB
testcase_11 AC 371 ms
81,340 KB
testcase_12 AC 373 ms
81,060 KB
testcase_13 WA -
testcase_14 AC 283 ms
81,196 KB
testcase_15 AC 47 ms
81,188 KB
testcase_16 AC 380 ms
81,236 KB
testcase_17 AC 370 ms
81,188 KB
testcase_18 AC 42 ms
81,192 KB
testcase_19 AC 133 ms
81,128 KB
testcase_20 AC 333 ms
81,328 KB
testcase_21 AC 91 ms
81,172 KB
testcase_22 AC 136 ms
81,012 KB
testcase_23 AC 201 ms
81,120 KB
testcase_24 AC 356 ms
81,184 KB
testcase_25 AC 49 ms
81,004 KB
testcase_26 AC 376 ms
81,008 KB
testcase_27 AC 374 ms
81,060 KB
testcase_28 AC 374 ms
81,196 KB
testcase_29 AC 370 ms
81,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;

int main(){
    ll n, tmp, cnt = 0;
    cin >> n;
    tmp = 10000000;
    vector<ll> prime(tmp, 1);
    set<ll> fac;
    prime[0] = 0;
    for (int i = 2; i <= tmp; i++){
        if (prime[i]){
            if (!fac.count(i)){
                for (int j = i+i; j < tmp; j += i){
                    prime[j] = 0;
                }
            }
            if (!(n%i)){
                cnt++;
                n /= i;
                i--;
            }
            if (cnt >= 2){
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
}
0