結果

問題 No.3236 累乗数大好きbot
ユーザー Carpenters-Cat
提出日時 2025-08-16 17:18:30
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 326 ms / 4,000 ms
コード長 529 bytes
コンパイル時間 1,826 ms
コンパイル使用メモリ 198,112 KB
実行使用メモリ 13,304 KB
最終ジャッジ日時 2025-08-16 17:18:41
合計ジャッジ時間 10,532 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
	std::vector<vector<ll>> rui(40);
	for (ll x = 2; x <= 1000000; x ++) {
		ll y = x * x;
		for (int i = 2; i < 40; i ++) {
			if (y > (ll)1e12) break;
			rui[i].push_back(y);
			y *= x;
		}
	}
	int N;
	cin >> N;
	while (N--) {
		ll x;
		cin >> x;
		int ans = 1;
		for (int i = 2; i < 40; i ++) {
			if (lower_bound(rui[i].begin(), rui[i].end(), x) != upper_bound(rui[i].begin(), rui[i].end(), x)) {
				ans = i;
			}
		}
		cout << ans << endl;
	}
}
0