結果
問題 | No.1666 累乗数 |
ユーザー | るさ |
提出日時 | 2021-09-03 22:27:40 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,785 ms / 2,000 ms |
コード長 | 881 bytes |
コンパイル時間 | 457 ms |
コンパイル使用メモリ | 86,876 KB |
実行使用メモリ | 79,132 KB |
最終ジャッジ日時 | 2023-08-21 23:08:31 |
合計ジャッジ時間 | 26,945 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 128 ms
77,584 KB |
testcase_01 | AC | 945 ms
78,372 KB |
testcase_02 | AC | 982 ms
78,724 KB |
testcase_03 | AC | 945 ms
79,132 KB |
testcase_04 | AC | 982 ms
78,884 KB |
testcase_05 | AC | 1,771 ms
78,756 KB |
testcase_06 | AC | 1,779 ms
78,492 KB |
testcase_07 | AC | 1,785 ms
78,956 KB |
testcase_08 | AC | 1,759 ms
78,780 KB |
testcase_09 | AC | 1,082 ms
78,532 KB |
testcase_10 | AC | 1,077 ms
78,628 KB |
testcase_11 | AC | 1,084 ms
78,828 KB |
testcase_12 | AC | 1,085 ms
78,976 KB |
testcase_13 | AC | 1,555 ms
78,576 KB |
testcase_14 | AC | 1,557 ms
78,504 KB |
testcase_15 | AC | 1,538 ms
78,920 KB |
testcase_16 | AC | 1,542 ms
78,852 KB |
testcase_17 | AC | 1,233 ms
78,340 KB |
testcase_18 | AC | 1,316 ms
79,048 KB |
testcase_19 | AC | 1,210 ms
78,884 KB |
ソースコード
def prime_table(n): n += 1 table = [i if i%2 else 2 for i in range(n)] for i in range(3, n, 2): if table[i] == i: for j in range(i*i, n, 2*i): if table[j] == j: table[j] = i return table def pc(n, table): p = set() while n != 1: pp = table[n] if pp in p: return 0 p.add(pp) n //= pp return len(p)%2*2 - 1 pt = prime_table(100) def cnt(n): ret = 0 for i in range(2, 80): tp = max(0, int(n ** (1/i))-2) while (tp+1) ** i <= n: tp += 1 #print(i, tp-1) ret += (tp-1) * pc(i, pt) return ret+1 for i in range(int(input())): l, r = -1, 10**18 k = int(input()) while r-l != 1: t = (l+r) // 2 c = cnt(t) if c >= k: r = t else: l = t print(r)