二分 奇怪的函数
问题描述
使得x^x达到或超过n位数字的最小正整数x是多少?
输入格式
输入一个正整数n(n<=2000 000 000)。
输出格式
输出使得x^x达到n位数字的最小正整数x。
输入样例
11
输出样例
10
限制与约定
时间限制:1s
空间限制:128MB
#include<iostream> #include<cstdio> #include<algorithm> #include<cmath> #include<cstring> using namespace std; int n; int main() { long long r=1000000000,l=1,t; cin>>n; while(l<r) { t=(l+r)/2; if(t*log10(t)+1>=n) r=t; else if(t*log10(t)<n) l=t+1; } cout<<r; return 0; }