现在的位置: 首页 > 综合 > 正文

zoj 2277 The Gate to Freedom

2019年08月14日 ⁄ 综合 ⁄ 共 264字 ⁄ 字号 评论关闭

            N^N = X

  --->    Nlog10(N) = log10( X )

 ---->    X的最高位为 Nlog10(N) 小数部分的第一个非0位

      

#include<stdio.h>
#include<math.h>

int main(void)
{
	double n;
	while(scanf("%lf",&n) != EOF)
	{
		n = n*log10(n);
		n = n - (long long int)n;
		n = pow(10,n);
		while((int)n == 0)
			n *= 10;
		printf("%d\n",(int)n);
	}
	return 0;
}

抱歉!评论已关闭.