結果
問題 | No.2751 429-like Number |
ユーザー |
|
提出日時 | 2024-05-10 21:48:43 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 515 bytes |
コンパイル時間 | 1,804 ms |
コンパイル使用メモリ | 193,516 KB |
最終ジャッジ日時 | 2025-02-21 12:33:52 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | TLE * 1 -- * 5 |
other | -- * 22 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; ll fct(ll x, int n) { return (n > 2 ? x * x * x : (n > 1 ? x * x : (n == 1 ? x : 1))); } bool isNumOfPrime(ll x, int n) { if (n == 0) { return x <= 1; } int fl = 2; while (fct(fl, n) <= x) { if (x % fl == 0) { while (x % fl == 0) { x /= fl; } return isNumOfPrime(x, n - 1); } } return n == 1; } int main() { int Q; cin >> Q; while (Q--) { ll N; cin >> N; cout << (isNumOfPrime(N, 3) ? "Yes" : "No") << endl; } }