【转】http://blog.youkuaiyun.com/zxy_snow/article/details/5938144
对于N^N = X两边取对数
N * LOG N = LOGX
求出Y = N*LOGN
对Y取小数 = z
X的最高位与Z的第一个非0位有关(因为10的整数次方的最高位都是1)
比如 10^10.5
它等于10^10*10^0.5
最高位就是10^0.5的最高位
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
long long n;
double x,y,z;
while( scanf("%lld",&n)!=EOF )
{
x = n * log10(n);
y = x - (long long int )x;
z = pow(10,y);
while( (int)z == 0 )
{
z *= 10;
}
printf("%d/n",(int)z);
}
return 0;
}
本文介绍了一种通过取对数计算X的最高位的方法,并提供了C++代码实现,详细解释了如何通过数学原理得出X的最高位与特定数值的关系。
787

被折叠的 条评论
为什么被折叠?



