結果

問題 No.1666 累乗数
ユーザー otoshigootoshigo
提出日時 2021-09-14 08:19:54
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 657 bytes
コンパイル時間 357 ms
コンパイル使用メモリ 86,968 KB
実行使用メモリ 79,676 KB
最終ジャッジ日時 2023-09-09 03:37:47
合計ジャッジ時間 38,545 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 152 ms
78,056 KB
testcase_01 AC 1,527 ms
78,336 KB
testcase_02 AC 1,543 ms
78,344 KB
testcase_03 AC 1,534 ms
78,460 KB
testcase_04 AC 1,526 ms
78,692 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 AC 1,608 ms
78,516 KB
testcase_10 AC 1,607 ms
78,692 KB
testcase_11 AC 1,653 ms
78,616 KB
testcase_12 AC 1,615 ms
79,076 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 AC 1,740 ms
78,668 KB
testcase_18 AC 1,856 ms
78,788 KB
testcase_19 AC 1,689 ms
78,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
def cnt_i(x,i):
    y = math.floor(pow(x,1/i))
    for j in range(y+2,y-3,-1):
        if j**i <= x:
            return j-1

def f(x,k):
    ju = 0
    cnt = [0 for _ in range(61)]
    for i in range(60,1,-1):
        c = cnt_i(x,i)
        for j in range(2*i,61,i):
            c -= cnt[j]
        cnt[i] = c
        ju += c
    if ju >= k-1:
        return True
    else:
        return False

def solve():
    k = int(input())
    ng = 0
    ok = 10**18+1
    while ok-ng > 1:
        mid = (ok+ng)//2
        if f(mid,k):
            ok = mid
        else:
            ng = mid
    print(ok)

t = int(input())
for _ in range(t):
    solve()
0