6
5
2015
0

XJOI 1702 奇怪的函数

//很容易想到要二分,因此关键是求x^x的位数
//x^x的位数=log10(x^x)+1=x*log10(x)+1
#include <iostream>
#include <cmath>
using namespace std;

int main(){
	long long n,l=1,r=2000000000,m;
	cin>>n;
	while (l!=r){
		m=(l+r)>>1;
		long long t=m*log10(m)+1;
		if (t>=n)
			r=m;
		else
			l=m+1;
	}
	cout<<l;
	return 0;
}
Category: 题解 | Tags: 二分 数学 XJOI

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com