結果

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>

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];
  }

  ll counter = 0;
  ll num;
  
  for(ll j=0; j<Q; j++){
    counter = 0;
    num = A[j];
    
    for(ll i=2; i <= pow(A[j], 0.5)+1; 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