結果

問題 No.1664 Unstable f(n)
ユーザー zezerozezero
提出日時 2021-09-03 21:48:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 601 bytes
コンパイル時間 3,009 ms
コンパイル使用メモリ 167,528 KB
実行使用メモリ 14,008 KB
最終ジャッジ日時 2024-05-09 03:07:19
合計ジャッジ時間 6,769 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
10,140 KB
testcase_01 AC 22 ms
5,376 KB
testcase_02 AC 14 ms
5,376 KB
testcase_03 AC 14 ms
5,376 KB
testcase_04 AC 14 ms
5,376 KB
testcase_05 AC 14 ms
5,376 KB
testcase_06 AC 14 ms
5,376 KB
testcase_07 AC 14 ms
5,376 KB
testcase_08 AC 13 ms
5,376 KB
testcase_09 AC 14 ms
5,376 KB
testcase_10 AC 13 ms
5,376 KB
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <cstring>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < int(n);i++)

int main(){
  ll n;
  cin >> n;
  ll ans = 1e18;
  for (ll i = 1; i < 1e7;i++){
    ll x = i;
    ans = min(ans,i+n-1);
    if (i == 1) continue;
    ll j = 1;
    while(x <= n){
      ans = min(ans,i+j+n-x);
      j++;
      x*=i;
    }
  }
  cout << ans << endl;
  return 0;
}
0