結果

問題 No.2751 429-like Number
ユーザー YY-otter
提出日時 2024-05-09 08:51:13
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 661 bytes
コンパイル時間 899 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 17,232 KB
最終ジャッジ日時 2024-12-20 04:01:16
合計ジャッジ時間 102,058 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6
other AC * 2 TLE * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;
typedef string str;

int main() {
  ll Q;
  cin >> Q;

  vector<ll> A(Q);
  for(ll i=0; i<Q; i++){
    cin >> A[i];
  }
  const ll SQRTED_N_MAX = 100000;

  ll counter = 0;
  ll num;
  
  for(ll j=0; j<Q; j++){
    counter = 0;
    num = A[j];
    
    for(ll i=2; i <= SQRTED_N_MAX; i++){
      while(num % i == 0){
        num /= i;
        counter++;
        if(counter > 3)
          goto label_break;
      }
    }
    if(num != 1)
      counter++;

    label_break:
    if(counter == 3)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  
  return 0;
}
0