結果

問題 No.1176 少ない質問
ユーザー a01sa01to
提出日時 2024-01-22 00:31:45
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 593 bytes
コンパイル時間 1,988 ms
コンパイル使用メモリ 193,404 KB
最終ジャッジ日時 2025-02-18 22:02:16
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
  #include "settings/debug.cpp"
  #define _GLIBCXX_DEBUG
#else
  #define Debug(...) void(0)
#endif
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;

inline int ceillog(ll x, int base) {
  int ans = 0;
  while (x > 0) {
    x /= base;
    ans++;
  }
  return ans;
}

int main() {
  ll a;
  cin >> a;
  ll ans = 1e18;
  for (ll b = 2; b <= ans; b++) {
    int p = ceillog(a, b);
    Debug(a, b, p, b * p, ans);
    ans = min(ans, (ll) b * p);
  }
  cout << ans << endl;
  return 0;
}
0