View Code of Problem 3888

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

const int MAX = 2e5+10;

int n;

int main()
{
    int T;
    scanf("%d",&T);
    while(T--)
    {
        scanf("%d",&n);
        double cnt=0;
        for(int i=2;i<=n;i++){
            cnt+=log(i)/log(10);
        }
        ll ans=floor(cnt);
        ans++;
        printf("%lld\n",ans);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 3888