結果
問題 | No.1176 少ない質問 |
ユーザー |
|
提出日時 | 2020-08-21 21:46:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 741 bytes |
コンパイル時間 | 1,507 ms |
コンパイル使用メモリ | 166,828 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-15 05:30:34 |
合計ジャッジ時間 | 2,234 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll=long long;const ll MOD=(ll)1e9+7;const ll INF=(ll)1e18+10;const double PI=acos(-1);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; }int dy[]={-1,1,0,0};int dx[]={0,0,-1,1};void solve(int cn) {ll A; cin>>A;ll maxi = ceil(log2(1.0*A));ll ans = A+1;for(ll i=maxi;i>=1ll;--i){ll tmp = i*ceil(pow(1.0*A,1.0/i));chmin(ans,tmp);}cout<<ans<<endl;}#define SINGLEint main() {#ifdef SINGLEsolve(1);#elseint N;cin>>N;for(int i=0;i<N;++i){solve(i);}#endifreturn 0;}