結果

問題 No.2751 429-like Number
ユーザー Y.Y.Y.Y.
提出日時 2024-05-09 08:52:49
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 646 bytes
コンパイル時間 904 ms
コンパイル使用メモリ 97,796 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-10 18:23:57
合計ジャッジ時間 17,831 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 128 ms
6,940 KB
testcase_07 AC 3,496 ms
6,940 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 89 ms
6,940 KB
testcase_12 AC 20 ms
6,940 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

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[i], 0.5); 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