結果

問題 No.2751 429-like Number
ユーザー 沙耶花沙耶花
提出日時 2024-05-10 21:37:33
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 1,123 ms / 4,000 ms
コード長 903 bytes
コンパイル時間 4,164 ms
コンパイル使用メモリ 263,344 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-20 04:39:26
合計ジャッジ時間 27,958 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 1000000000000000001

bool is_prime(long long n){
      if(n == 1) return false;
      for(long long i = 2; i * i <= n; i++){
         if(n % i == 0) return false;
      }
      return true;
   
}
int main(){
   vector<long long> ps;
   for(long long i=1;i<=100000;i++){
      if(is_prime(i)){
         ps.push_back(i);
      }
   }
   int t;
   cin>>t;
   rep(i,t){
      long long a;
      cin>>a;
      long long c = 0;
      rep(j,ps.size()){
         while(a%ps[j] ==0){
            c++;
            a /= ps[j];
         }
      }
      if(a!=1)c++;
      if(c==3){
         cout<<"Yes"<<endl;
      }
      else{
         cout<<"No"<<endl;
      }
   }
  
	return 0;
}
0