結果

問題 No.1664 Unstable f(n)
ユーザー Yug_min_null
提出日時 2021-09-03 21:48:31
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 2,389 ms
コンパイル使用メモリ 189,336 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-15 12:04:04
合計ジャッジ時間 3,650 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  long long N; cin >> N;
  vector<int> S(9);
  S[2] = sqrt(N);
  for(int i = 3; i < 9; i++){
    S[i] = sqrt(S[i-1]);
  }
  long long ans = 1000000000000000000;
  for(int i = 2; i < 9; i++){
    if(S[i] == 1) break;
    long long T = N - pow(S[i],i);
    ans = min(ans, S[i]+i+T);
  }
  if(N < 4) ans = N;
  cout << ans << endl;
}
0