結果

問題 No.2751 429-like Number
コンテスト
ユーザー tobbie
提出日時 2024-06-09 13:27:30
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 3,034 ms / 4,000 ms
コード長 576 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,248 ms
コンパイル使用メモリ 180,816 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-03 19:17:10
合計ジャッジ時間 11,614 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

#define rep(i, n) for (int i=0; i<(int)n; i++)
using ll = long long int;

int prime_factorize(ll n, vector<pair<ll, int>> &p) {
  int k = 0;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) {
      k++;
      n /= i;
      if (k > 3) return k;
    }
  }
  if (n != 1)
    k += 1;
  return k;
}

int main() {
  int Q;
  cin >> Q;
  rep(i, Q) {
    ll Ai;
    cin >> Ai;
    vector<pair<ll, int>> p;
    if (prime_factorize(Ai, p) == 3)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  return 0;
}
0