結果

問題 No.1176 少ない質問
ユーザー kyo1
提出日時 2020-08-31 07:27:26
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 14 ms / 1,000 ms
コード長 455 bytes
コンパイル時間 1,921 ms
コンパイル使用メモリ 193,288 KB
最終ジャッジ日時 2025-01-14 02:17:31
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int64_t A;
  cin >> A;
  auto f = [](int64_t a, int b) {
    int res = 0;
    while (a > 0) {
      a /= b;
      res++;
    }
    return res;
  };
  int bmax = f(A, 2);
  int res = 1 << 28;
  for (int i = 2; i < bmax + 100; i++) {
    res = min(res, i * f(A, i));
    if (i >= A) res = min(res, i);
  }
  cout << res << '\n';
  return 0;
}
0