【题解】
取个对数然后二分即可。对于一个数x,x^x的位数就是(int)(lg(x)*x+1).
1 #include<cstdio> 2 #include<cstring> 3 #include<algorithm> 4 #include<cmath> 5 #define LL long long 6 #define rg register 7 #define N 200010 8 using namespace std; 9 int n,l,r,mid; 10 inline int read(){ 11 int k=0,f=1; char c=getchar(); 12 while(c<'0'||c>'9')c=='-'&&(f=-1),c=getchar(); 13 while('0'<=c&&c<='9')k=k*10+c-'0',c=getchar(); 14 return k*f; 15 } 16 inline bool check(){ 17 long double lg=log10(mid); 18 return lg*mid+1>=n; 19 } 20 int main(){ 21 n=read(); 22 l=1; r=n; 23 while(l+1<r){ 24 mid=(l+r)>>1; 25 if(check()) r=mid; else l=mid; 26 } 27 printf("%d\n",r); 28 return 0; 29 }