結果

問題 No.2751 429-like Number
ユーザー cled0328cled0328
提出日時 2024-05-10 21:56:51
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,085 ms / 4,000 ms
コード長 638 bytes
コンパイル時間 2,006 ms
コンパイル使用メモリ 203,344 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-05-10 21:57:06
合計ジャッジ時間 14,548 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 AC 3 ms
6,940 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 5 ms
6,940 KB
testcase_07 AC 452 ms
6,944 KB
testcase_08 AC 41 ms
6,944 KB
testcase_09 AC 1,083 ms
6,940 KB
testcase_10 AC 1,085 ms
6,940 KB
testcase_11 AC 1,011 ms
6,940 KB
testcase_12 AC 434 ms
6,940 KB
testcase_13 AC 1,050 ms
6,944 KB
testcase_14 AC 1,050 ms
6,944 KB
testcase_15 AC 20 ms
6,940 KB
testcase_16 AC 469 ms
6,940 KB
testcase_17 AC 507 ms
6,940 KB
testcase_18 AC 444 ms
6,940 KB
testcase_19 AC 434 ms
6,944 KB
testcase_20 AC 456 ms
6,944 KB
testcase_21 AC 432 ms
6,940 KB
testcase_22 AC 438 ms
6,944 KB
testcase_23 AC 458 ms
6,940 KB
testcase_24 AC 428 ms
6,940 KB
testcase_25 AC 467 ms
6,940 KB
testcase_26 AC 436 ms
6,940 KB
testcase_27 AC 456 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int q;cin>>q;
    vector<int> a(100001,1);
    vector<int> b;
    for(int i=2;i<=400;i++){
        if(!a[i])continue;
        for(int j=i*i;j<=100000;j+=i){
            a[j]=0;
        }
    }
    for(int i=2;i<=100000;i++)if(a[i])b.push_back(i);
    while(q--){
        long long n;cin>>n;
        int ct=0;
        for(auto i:b){
            while(n%i==0){
                ct++;
                n/=i;
                if(ct>=3)break;
            }
            if(ct>=3)break;
        }
        if((ct==3&&n==1)||(ct==2&&n>1))cout<<"Yes\n";
        else cout<<"No\n";
    }
}
0