https://www.luogu.org/problem/P2759
题意(如题
题目描述
使得 x^x 达到或超过 n 位数字的最小正整数 x 是多少?
n<=2000000000
参考
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
int n;
int ans;
int check(int x) {
if(x*log10(x) < n-1) return 0;
return 1;
}
int main() {
cin>>n;
int l = 1, r = n, mid;
while(l <= r) {
mid = (l+r)>>1;
if(check(mid)) {
r = mid-1;
ans = mid;
} else {
l = mid+1;
}
}
cout << (int)ans;
}