結果

問題 No.1664 Unstable f(n)
ユーザー james
提出日時 2021-09-03 23:38:53
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
RE  
実行時間 -
コード長 469 bytes
コンパイル時間 467 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-12-15 18:44:41
合計ジャッジ時間 2,629 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 3
other RE * 38
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n = int(input())
    # as multiple as possible

    ans = n
    for i in range(1,62):
        l,r = 0,n+1
        while r-l > 1:
            mid = (r + l) // 2
            if isok(mid, i):
                l = mid
            else:
                r = mid
        ans = min(n-l ** i + l + i, ans)
    
    return print(ans)

def isok(mid, p):
    if mid ** p > n:
        return False
    else:
        return True


if __name__ == "__main__":
    main()
0