結果
| 問題 |
No.1666 累乗数
|
| コンテスト | |
| ユーザー |
umezo
|
| 提出日時 | 2021-09-03 23:20:01 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 704 bytes |
| コンパイル時間 | 2,169 ms |
| コンパイル使用メモリ | 191,472 KB |
| 最終ジャッジ日時 | 2025-01-24 07:12:26 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | TLE * 1 |
| other | TLE * 19 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
ll modpow(ll x,ll n){
ll ans=1;
while(n){
if(n&1) ans=ans*x;
x=x*x;
n/=2;
}
return ans;
}
bool f(ll x,ll k){
ll cnt=0;
ll i=2;
while(pow(x,1/i)>=1){
cnt+=(ll)pow(x,1/i);
i++;
}
if(cnt>=k) return true;
else return false;
}
int main(){
ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t;
cin>>t;
while(t--){
ll k;
cin>>k;
ll ng=0,ok=1e9+1;
while(ok-ng>1){
ll mid=(ng+ok)/2;
if(f(mid,k)) ok=mid;
else ng=mid;
}
cout<<ok<<endl;
}
return 0;
}
umezo