結果

問題 No.1664 Unstable f(n)
ユーザー houren
提出日時 2021-12-08 21:59:36
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 1,651 ms
コンパイル使用メモリ 167,028 KB
実行使用メモリ 13,880 KB
最終ジャッジ日時 2024-07-16 09:54:20
合計ジャッジ時間 5,344 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 3 TLE * 1 -- * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()

int main(){
    ll n;
    cin >> n;
    ll ans = 1LL<<60;
    for(ll i=2;i<=ans;i++){
        ll x = 1, cnt = 0;
        while(x<=n/i){
            x *= i;
            cnt++;
        }
        ans = min(ans, i+cnt+n-x);
    }
    cout << ans << endl;
    return 0;
}
0