結果

問題 No.2751 429-like Number
ユーザー otoshigo
提出日時 2024-05-10 23:25:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,058 ms / 4,000 ms
コード長 863 bytes
コンパイル時間 1,997 ms
コンパイル使用メモリ 196,004 KB
最終ジャッジ日時 2025-02-21 13:21:40
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;}
template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
	int Q;
	cin>>Q;
	vector<bool>flag(100001,true);
	flag[1]=false;
	for(int i=2;i<=100000;i++){
		if(!flag[i])continue;
		for(int j=2*i;j<=100000;j+=i){
			flag[j]=false;
		}
	}
	vector<int>P;
	for(int i=2;i<=100000;i++){
		if(flag[i]){
			P.push_back(i);
		}
	}
	while(Q--){
		ll A;
		cin>>A;
		int cnt=0;
		for(auto x:P){
			if(x>A)break;
			if(A%x==0){
				while(A%x==0){
					cnt++;
					A/=x;
				}
			}
		}
		if(A>1)cnt++;
		if(cnt==3)cout<<"Yes\n";
		else cout<<"No\n";
	}
}
0