結果

問題 No.1664 Unstable f(n)
ユーザー shiroha_F14
提出日時 2021-07-29 19:25:06
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 336 bytes
コンパイル時間 1,507 ms
コンパイル使用メモリ 167,932 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-15 08:46:50
合計ジャッジ時間 2,333 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 WA * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main(){
  ll n; cin >> n;
  if(n < 4LL){
    cout << n << endl;
  }else{
    ll ans = LLONG_MAX;
    for(ll j = 2; j <= log2(n); j++){
      ll i = pow(n, 1.0 / j);
      ll k = n - pow(i, j);
      ans = min(ans, i + j + k);
    }
    cout << ans << endl;
  }
}
0