結果
問題 | No.1176 少ない質問 |
ユーザー |
![]() |
提出日時 | 2024-01-22 00:32:53 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 590 bytes |
コンパイル時間 | 1,997 ms |
コンパイル使用メモリ | 190,920 KB |
最終ジャッジ日時 | 2025-02-18 22:02:24 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#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 = a;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;}