結果

問題 No.1176 少ない質問
ユーザー Yahiya YusufzaiYahiya Yusufzai
提出日時 2020-08-22 15:17:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 2,390 bytes
コンパイル時間 1,719 ms
コンパイル使用メモリ 165,360 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-23 09:39:39
合計ジャッジ時間 2,757 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
#include<tuple>
#define INF  (int)1e8
#define EPS   1e-9
#define MOD 1000000007
#define Pi 3.14159
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define rep(i,a,n) for (int i=a;i<n;i++)
#define repk(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
// input macro
#define IN(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}
//output macro
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printPI(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
// shortcut for data type
#define ll long long
#define PI pair<int,int>
#define PL pair<ll,ll>
#define vi vector<int>
#define vb vector<bool>
#define vl vector<ll>
#define vvi vector<vi>
#define vvl vector<vl>
#define vvvi vector<vvi>
#define vvvl vector<vvl>
#define vpi vector<pi>
#define vpl vector<pl>
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define F first
#define S second
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define dbg(x, y) cout << x << " = " << y << endl
using namespace std;


const int N = 1e5 + 5;


ll gcd(ll a, ll b) {ll temp; while (b > 0) {temp = a % b; a = b; b = temp;} return a;}
ll lcm(ll a, ll b) {return a * b / gcd(a, b);}
ll fpow(ll  b, ll exp, ll mod) {if (exp == 0) return 1; ll t = fpow(b, exp / 2, mod); if (exp & 1) return t * t % mod * b % mod; return t * t % mod;}
ll divmod(ll i, ll j, ll mod) {i %= mod, j %= mod; return i * fpow(j, mod - 2, mod) % mod;}



void sol() {
	// int x1, y1, z1, x2, y2, z2; cin >> x1 >> y1 >> z1;
	// cin >> x2 >> y2 >> z2;

	// ll mn = min(z1, y2) * 2;
	// ll cnt = 0;
	// ll cnt2 = (z1 - mn);
	// if (z2 > x1)
	// 	cnt = (z2 - x1);

	// if (cnt2 > 0)
	// 	cnt -= cnt2;
	// ll a = mn;

	// if (cnt > 0)
	// 	a -= (cnt * 2);

	// cout << a << "\n";
	ll a;
	while (cin >> a) {
		ll res = a;
		for (ll i = 2;; i++) {
			if (i >= res)break;
			int cnt = 0;
			ll cur = a;
			while (cur > 1) {
				cnt++;
				cur = (cur + i - 1) / i;

			}
			res = min(res, cnt * i);
		}
		cout << res << '\n';
	}
}

int main() {
	// ios::sync_with_stdio(fAlse);
	// cin.tie(0);
	int t = 1;
	// cin >> t;
	while (t--)
		sol();

	return 0;
}

0