hdu Big Number

 1 #include <cstdio>

 2 #include <cstring>

 3 #include <cmath>

 4 using namespace std;

 5 

 6 int main()

 7 {

 8     int t,n;

 9     scanf("%d",&t);

10     while(t--)

11     {

12         scanf("%d",&n);

13         double sum=0;

14         for(int i=1; i<=n; i++)

15         {

16             sum+=log10((double)i);

17         }

18         printf("%d\n",(int)sum+1);

19     }

20     return 0;

21 }
View Code

 

你可能感兴趣的:(number)