結果

問題 No.1176 少ない質問
ユーザー yakkiyakki
提出日時 2020-08-21 21:38:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,033 bytes
コンパイル時間 980 ms
コンパイル使用メモリ 117,864 KB
実行使用メモリ 17,080 KB
最終ジャッジ日時 2024-04-23 05:38:40
合計ジャッジ時間 5,294 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<numeric>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    ll a; cin >> a;
    ll ans = a;
    for(int i = 2; i*i*i <= a; i++){
        ll cnt = 0;
        ll now = 1;
        while(true){
            now *= i;
            cnt++;
            if(now >= a/i) break;
        }
        ans = min(ans,i*(cnt+1));
    }
    ll k = (ll)sqrt(a);
    if(k*k >= a) ans = min(ans,k*2);
    else ans = min(ans,(k+1)*2);
    cout << ans << endl;
}

0