結果
| 問題 |
No.2751 429-like Number
|
| コンテスト | |
| ユーザー |
FplusFplusF
|
| 提出日時 | 2024-05-10 21:51:08 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2,121 ms / 4,000 ms |
| コード長 | 1,569 bytes |
| コンパイル時間 | 3,210 ms |
| コンパイル使用メモリ | 248,136 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-20 05:09:47 |
| 合計ジャッジ時間 | 22,772 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll,ll>;
using ld=long double;
const ll INF=(1ll<<60);
#define rep(i,n) for (ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(),v.end()
template<class T> inline bool chmin(T &a,T b){
if(a>b){
a=b;
return true;
}
return false;
}
template<class T> inline bool chmax(T &a,T b){
if(a<b){
a=b;
return true;
}
return false;
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ll n=1e5+1;
vector<ll> p(n,1);
for(ll i=2;i<n;i++){
if(!p[i]) continue;
for(ll j=i+i;j<n;j+=i) p[j]=0;
}
vector<ll> v;
for(ll i=2;i<n;i++){
if(p[i]) v.push_back(i);
}
ll q;
cin >> q;
while(q--){
ll a;
cin >> a;
ll x=a;
vector<ll> now;
ll cnt=0;
for(auto i:v){
while(x%i==0){
cnt++;
now.push_back(i);
if(3<cnt) break;
x/=i;
}
if(3<cnt) break;
}
bool yn=false;
if(cnt==2){
a/=now[0];
a/=now[1];
bool ok=true;
for(ll i=2;i*i<=a;i++){
if(a%i==0){
ok=false;
break;
}
}
if(a!=1&&ok) yn=true;
}
if(cnt==3){
if(now[0]*now[1]*now[2]==a) yn=true;
}
if(yn) cout << "Yes\n";
else cout << "No\n";
}
}
FplusFplusF