結果
問題 | No.1176 少ない質問 |
ユーザー |
|
提出日時 | 2020-08-22 15:17:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 2,390 bytes |
コンパイル時間 | 1,577 ms |
コンパイル使用メモリ | 168,900 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-15 09:34:02 |
合計ジャッジ時間 | 2,354 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#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 << endlusing 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;}