結果
| 問題 | 
                            No.2751 429-like Number
                             | 
                    
| コンテスト | |
| ユーザー | 
                             tnakao0123
                         | 
                    
| 提出日時 | 2024-05-17 16:58:40 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1,004 ms / 4,000 ms | 
| コード長 | 1,129 bytes | 
| コンパイル時間 | 596 ms | 
| コンパイル使用メモリ | 62,500 KB | 
| 最終ジャッジ日時 | 2025-02-21 14:23:22 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 6 | 
| other | AC * 22 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:64:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   64 |   scanf("%d", &tn);
      |   ~~~~~^~~~~~~~~~~
main.cpp:68:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   68 |     scanf("%lld", &ai);
      |     ~~~~~^~~~~~~~~~~~~
            
            ソースコード
/* -*- coding: utf-8 -*-
 *
 * 2751.cc:  No.2751 429-like Number - yukicoder
 */
#include<cstdio>
#include<vector>
#include<algorithm>
 
using namespace std;
/* constant */
const int MAX_P = 100000 + 100;
/* typedef */
typedef long long ll;
typedef vector<bool> vb;
typedef vector<int> vi;
/* global variables */
vb primes;
vi pnums;
/* subroutines */
int gen_primes(int maxp) {
  primes.assign(maxp + 1, true);
  primes[0] = primes[1] = false;
  int p;
  for (p = 2; p * p <= maxp; p++)
    if (primes[p]) {
      pnums.push_back(p);
      for (int q = p * p; q <= maxp; q += p) primes[q] = false;
    }
  for (; p <= maxp; p++)
    if (primes[p]) pnums.push_back(p);
  return (int)pnums.size();
}
int prime_decomp(ll n) {
  int cnt = 0;
  for (auto pi: pnums) {
    if ((ll)pi * pi > n) {
      if (n > 1) cnt++;
      break;
    }
    while (n % pi == 0) n /= pi, cnt++;
  }
  return cnt;
}
/* main */
int main() {
  gen_primes(MAX_P);
  int tn;
  scanf("%d", &tn);
  while (tn--) {
    ll ai;
    scanf("%lld", &ai);
    
    if (prime_decomp(ai) == 3) puts("Yes");
    else puts("No");
  }
  
  return 0;
}
            
            
            
        
            
tnakao0123