Wednesday 30 January 2013

5917. Factorial length Problem code: LENGFACT

#include <cmath>
#include <cstdio>
using namespace std;
int main()
{
    double num, length, pi = acos(-1.0);
    int t;
    scanf("%d", &t);
    while(t--)
        scanf("%lf", &num),printf("%.0lf\n", num<3.0? 1.0 : floor((num*log(num)-num+(log(2.0*pi*num))/2.0)/log(10.0))+1.0 );
    return 0;
}

No comments:

Post a Comment