【JZOJ】YY

YY

(某些同学不要想太多)
给出 m ( m < = 500000 ) m(m<=500000) ,求出 n ( n n = m ) n(n^n=m)

输入

样例输入
387420489
样例输出
9

思路

有关换底公式

#include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	freopen("yy.in","r",stdin);
	freopen("yy.out","w",stdout);
	string s;
	cin>>s;
	for(int i=1;i<=s.length();++i)
		if(floor(i*log10(i)+1)==s.length())
		{
			printf("%d",i);
			break;
		}
	fclose(stdin);
	fclose(stdout);
	return 0;
}

猜你喜欢

转载自blog.csdn.net/SSL_wujiajie/article/details/86694772
yy