結果
| 問題 |
No.2751 429-like Number
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-05-10 22:58:13 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 1,029 ms / 4,000 ms |
| コード長 | 911 bytes |
| コンパイル時間 | 3,621 ms |
| コンパイル使用メモリ | 251,328 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-20 07:07:56 |
| 合計ジャッジ時間 | 25,212 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 6 |
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int M = 100005;
vector<int> isPrime(M);
vector<int> prime;
for (int i = 2; i < M; i++){
if (isPrime[i]) continue;
prime.push_back(i);
for (int j = i; j < M; j+= i){
isPrime[j] = 1;
}
}
int q;
cin >> q;
for (int i = 0; i < q; i++){
long long a;
cin >> a;
vector<long long> facts;
bool ok = true;
for (auto p : prime){
if (a%p) continue;
while (a%p == 0){
facts.push_back(p);
a /= p;
}
}
if (a != 1) facts.push_back(a);
if (ok && facts.size() == 3){
cout << "Yes" << endl;
} else {
cout << "No" << endl;
}
}
return 0;
}