标签:else std mat include bsp class div code lap
x^x>=10^(n-1)
lg x^x>=n-1
x*lg x>=n-1
x*(log2 x/log2 10)>=n-1
左边单调递增,二分x即可
1 #include<cstdio> 2 #include<cstring> 3 #include<cmath> 4 using namespace std; 5 const int N=1000000000; 6 int n,l,r,mid; 7 int check(int x){ 8 if (x*(log(x)/log(10))>=n-1) 9 return 1; 10 return 0; 11 } 12 int main(){ 13 scanf("%d",&n); 14 l=1;r=N; 15 while (l<r){ 16 mid=(l+r)>>1; 17 if (check(mid)) r=mid; 18 else l=mid+1; 19 } 20 printf("%d",l); 21 return 0; 22 }
标签:else std mat include bsp class div code lap
原文地址:http://www.cnblogs.com/Absolute-Zero/p/6012034.html