一个换底公式解决的事
https://www.luogu.org/problemnew/show/P2759
题摘使得 x^x
达到或超过 n 位数字的最小正整数 x 是多少?
求x^x次方的位数,可用x*log10(x)+1
#include<iostream>
#include<cmath>
#define ll long long
using namespace std;
ll n;
int pd(ll x){
return (long long)(x*log10(x)+1)>=n;
}
int main(){
cin>>n;
ll l=0,r=2000000010;
ll ans=r;
while (l<=r){//二分
ll mid=l+(r-l)/2; //防爆装置
if (pd(mid)){
ans=mid;
r=mid-1;
}
else l=mid+1;
}
cout<<ans;
return 0;
}