結果
| 問題 | 
                            No.2751 429-like Number
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-05-10 21:49:11 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 524 bytes | 
| コンパイル時間 | 2,161 ms | 
| コンパイル使用メモリ | 192,248 KB | 
| 最終ジャッジ日時 | 2025-02-21 12:35:10 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 2 TLE * 1 -- * 1 | 
| 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);
		}
		fl ++;
	}
	return n == 1;
}
int main() {
	int Q;
	cin >> Q;
	while (Q--) {
		ll N;
		cin >> N;
		cout << (isNumOfPrime(N, 3) ? "Yes" : "No") << endl;
	}
}