标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 31846 Accepted Submission(s): 14853
#include<stdio.h>
#include<math.h>
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
int m,i;
double s=0;
scanf("%d",&m);
for(i=1;i<=m;i++)
s=s+log10(double(i));
printf("%d\n",(int)s+1);
}
return 0;
}
法二:
#include<stdio.h>
#include<math.h>
#define p 3.14159265
#define e 2.71828182
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
int m,i;
double s;
scanf("%d",&m);
s=log10(2*p*m)/2+m*log10(m/e);
printf("%d\n",(int)s+1);
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/-lgh/p/4937832.html