結果
| 問題 |
No.1666 累乗数
|
| コンテスト | |
| ユーザー |
monnu
|
| 提出日時 | 2021-09-04 15:13:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,181 bytes |
| コンパイル時間 | 3,942 ms |
| コンパイル使用メモリ | 229,796 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-18 01:57:25 |
| 合計ジャッジ時間 | 35,816 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<pair<int,int>>>;
#define MAX 100000
#define MOD 1000000007
#define INF 1000000000000000000
ll my_pow(ll x,int n){
ll ret=1;
while(n>0){
if((n&1)==1){
ret=ret*x;
}
n>>=1;
x=x*x;
}
return ret;
}
//x以下の累乗数の個数
ll counting(ll x){
if(x==0){
return 0;
}
ll ans=1;
for(int b=2;b<=60;b++){
ll left=0;
ll right=1000000001;
while(left+1<right){
ll c=(left+right)/2;
if(pow((ll)c,b)>=2e18){
right=c;
continue;
}
if(my_pow(c,b)<=x){
left=c;
}else{
right=c;
}
}
int cnt=0;
for(int i=2;i<=b;i++){
if(b%i==0){
cnt++;
}
}
if(cnt==1){
ans+=left-1;
}
}
return ans;
}
void solve(){
ll K;
cin>>K;
ll left=0;
ll right=1000000000000000001;
while(left+1<right){
ll c=(left+right)/2;
if(counting(c)<K){
left=c;
}else{
right=c;
}
}
cout<<right<<'\n';
}
int main(){
int T;
cin>>T;
for(int i=0;i<T;i++){
solve();
}
}
monnu