hdu 1060_数学

来源:互联网 发布:找车拉货用什么软件 编辑:程序博客网 时间:2024/05/22 06:57

http://acm.hdu.edu.cn/showproblem.php?pid=1060

/*任何一个数字都可以n表示成10^(a+b),其中a>=1,b<1。如:n=87455时,a=4,b=0.941784644. 87455 = 10^(4+0.941784644)=10^4 * 10^0.941784644 = 10000 * 8.7455 由sum=N^N,两边对10取对数,log10(sum)=Nlog10(N),有sum=10^(Nlog10(N))*/#include<stdio.h>#include <math.h>int main(){    int a,t;    scanf("%d",&t);    while(t--){        scanf("%d",&a);        double b = (a * log10(a * 1.0) - (__int64)(a * log10(a * 1.0)));        double ans = pow(10 * 1.0,b);        printf("%d\n",(int)ans);    }       return 0;}


0 0
原创粉丝点击