結果

問題 No.2751 429-like Number
ユーザー t98slidert98slider
提出日時 2024-05-16 05:48:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 696 ms / 4,000 ms
コード長 832 bytes
コンパイル時間 2,150 ms
コンパイル使用メモリ 205,800 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-16 05:48:47
合計ジャッジ時間 6,064 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 4 ms
6,940 KB
testcase_08 AC 5 ms
6,944 KB
testcase_09 AC 11 ms
6,940 KB
testcase_10 AC 696 ms
6,940 KB
testcase_11 AC 149 ms
6,944 KB
testcase_12 AC 143 ms
6,944 KB
testcase_13 AC 115 ms
6,940 KB
testcase_14 AC 320 ms
6,944 KB
testcase_15 AC 9 ms
6,940 KB
testcase_16 AC 47 ms
6,940 KB
testcase_17 AC 61 ms
6,940 KB
testcase_18 AC 110 ms
6,940 KB
testcase_19 AC 112 ms
6,944 KB
testcase_20 AC 115 ms
6,940 KB
testcase_21 AC 108 ms
6,944 KB
testcase_22 AC 108 ms
6,944 KB
testcase_23 AC 108 ms
6,940 KB
testcase_24 AC 111 ms
6,944 KB
testcase_25 AC 111 ms
6,940 KB
testcase_26 AC 123 ms
6,940 KB
testcase_27 AC 113 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<bool> tb(70923, true);
    vector<int> p;
    p.reserve(7023);
    tb[0] = tb[1] = false;
    p.push_back(2);
    for(int i = 4; i <= 70922; i += 2) tb[i] = false;
    for(int i = 3; i <= 70922; i += 2){
        if(!tb[i]) continue;
        p.emplace_back(i);
        for(int j = i, d = 2 * i; j <= 70922; j += d) tb[j] = false;
    }
    
    int Q;
    cin >> Q;
    while(Q--){
        ll v;
        cin >> v;
        int cnt = 0;
        for(int i = 0; i < 7023 && (ll)(p[i]) * p[i] <= v; i++){
            while(v % p[i] == 0){
                v /= p[i];
                cnt++;
            }
        }
        if(v != 1) cnt++;
        cout << (cnt == 3 ? "Yes" : "No") << '\n';
    }
}
0