結果

問題 No.1666 累乗数
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-04-09 21:55:09
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 528 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 82,288 KB
実行使用メモリ 78,048 KB
最終ジャッジ日時 2024-04-09 21:55:30
合計ジャッジ時間 19,493 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
66,720 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

t = int(input())

for _ in range(t):
	k = int(input())
	ng ,ok = 0, k * k + 10
	while ok - ng > 1:
		mid = (ok + ng) // 2
		# mid以下の累乗数の個数を求める
		cnt = [0] * 63
		for i in range(2, 63):
			cnt[i] = math.ceil(math.pow(mid, 1 / i))
			while pow(cnt[i], i) > mid:
				cnt[i] -= 1
			while pow(cnt[i] + 1, i) <= mid:
				cnt[i] += 1
			cnt[i] -= 1
		for i in range(2, 63):
			for j in range(2 * i, 63, i):
				cnt[i] -= cnt[j]
		if sum(cnt) + 1 >= k:
			ok = mid
		else:
			ng = mid
	print(ok)
0