結果
問題 |
No.1666 累乗数
|
ユーザー |
|
提出日時 | 2023-11-17 19:45:36 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,011 bytes |
コンパイル時間 | 269 ms |
コンパイル使用メモリ | 82,252 KB |
実行使用メモリ | 83,200 KB |
最終ジャッジ日時 | 2024-09-26 05:32:24 |
合計ジャッジ時間 | 4,186 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | TLE * 1 -- * 18 |
ソースコード
from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline def floor_sqrt(n,m): y = n+1 def is_smaller(x): if x**m <= n: return True return False x = 0 while y-x>1: mid = (y+x)//2 if is_smaller(mid): x = mid else: y = mid return x def answer(): K = int(input()) def is_ok(x): dp = [0]*101 for i in range(100,1,-1): dp[i] = floor_sqrt(x,i)-1 for j in range(2*i,101,i): dp[i] -= dp[j] # print(x,dp) return sum(dp[2:]) + 1>=K y = K**2 x = 0 while y-x>1: mid = (y+x)//2 if is_ok(mid): y = mid else: x = mid print(y) # print() for _ in range(int(input())): answer()