結果
問題 | No.1176 少ない質問 |
ユーザー | misora192 |
提出日時 | 2020-08-21 22:29:59 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,148 bytes |
コンパイル時間 | 1,561 ms |
コンパイル使用メモリ | 163,324 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-04-23 06:10:41 |
合計ジャッジ時間 | 1,922 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 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 | 1 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 | 1 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 | 1 ms
5,376 KB |
testcase_19 | AC | 2 ms
5,376 KB |
testcase_20 | AC | 1 ms
5,376 KB |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=(0);i<(n);i++) using namespace std; typedef long long ll; template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; } // condを満たす最小のxを求める(lower_bound) // 全てのxが条件を満たさない場合はnを返す(nはとりえない値) ll INF = 1e18 + 1e17; double eps = 1e-10; bool cond(ll t, ll y, ll a){ double ret = 1.0; rep(i, y) ret *= (double) t; return (double) a < ret + eps; } ll lower_bound_cond(ll y, ll a){ ll lb = 2, ub = INF; while(ub - lb > 1){ ll mid = (lb + ub) / 2; bool ok = cond(mid, y, a); // cout << y << "," << mid << "," << ok << endl; if(ok) ub = mid; // Answer is in (lb, mid] else lb = mid; // Answer is in (mid, ub] } // now lb + 1 = ub return ub; } int main(){ cin.tie(0); ios::sync_with_stdio(false); ll a; cin >> a; ll ans = INF; // for(ll y = 1; y <= 62; y++){ for(ll y = 1; y <= 62; y++){ ll x = lower_bound_cond(y, a); chmin(ans, x * y); } cout << ans << endl; }