結果

問題 No.2751 429-like Number
ユーザー KeiKei
提出日時 2024-05-10 23:16:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 673 bytes
コンパイル時間 2,258 ms
コンパイル使用メモリ 205,640 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-10 23:16:24
合計ジャッジ時間 4,385 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 AC 3 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 WA -
testcase_07 AC 27 ms
6,940 KB
testcase_08 AC 26 ms
6,940 KB
testcase_09 AC 26 ms
6,940 KB
testcase_10 AC 28 ms
6,944 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 25 ms
6,940 KB
testcase_15 AC 33 ms
6,940 KB
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 -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
int sqA = 100010;
int main() {
  vector<int> p;
  vector<bool> isp(sqA + 1, true);
  for (int i = 2; (long long) i * i <= sqA; i++) {
    if (isp[i]) {
      p.push_back(i);
      for (long long j = (long long)i * i; j <= sqA; j+=i) {
        isp[j] = false;
      }
    }
  }
  int Q;
  cin >> Q;
  int Np = p.size();
  while (Q--) {
    long long A;
    cin >> A;
    int cnt = 0;
    for (int i = 0; i < Np; i++) {
      if (A % p[i] == 0) {
        while (A % p[i] == 0) {
          A /= p[i];
          cnt++;
        }
      } 
    }
    if (A > 1) {
      cnt++;
    }
    cout << (cnt == 3 ? "Yes" : "No") << endl;
  }
}
0