問題一覧 > 通常問題

No.1664 Unstable f(n)

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 134
作問者 : shiroha_F14 / テスター : netyo715
お気に入りにしたユーザー ProblemId : 6794 / 自分の提出
問題文最終更新日: 2021-08-03 15:54:01
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 312 (順位表) の他の問題:

Problem Statement

You are given a positive integer $n$.
Consider representing $n$ in the form $n={i^j}+k$ using a positive integer $i$ and non-negative integers $j, k$.
Find the value of $i+j+k$ for a combination of $i, j, k$ that minimizes $i+j+k$.
Here, $x^0=1$ for any positive integer $x$.

Input

$n$ 

  • $1 \leq n \leq 10^{18}$
  • $n$ is a positive integer

Output

Print the answer on one line, followed by a newline.

Sample

Sample 1
Input
12
Output
8

To represent $12$ as the problem requires,

  • $2^3+4$
  • $3^2+3$
are the two possible ways.

Sample 2
Input
14156722839
Output
125499

We have $118982^2+6515=14156722839$.

Sample 3
Input
454275
Output
2021

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。