問題C:階乗メジアン
制限時間:1秒メモリ制限:128メガバイト
[提出] [状態]
記載表題
の整数を使用する多くのソフトウェアを必要としています。例えば、いくつかのソフトウェアは、それほどに大きな数字やデータセキュリティの暗号鍵転送とに使用されます。この問題では、ビット数に応じて、あなたは、数の階乗を計算するために、あなたの整数を与えたいです。
入力
線の整数を含みます。最初の行のnは、n行が続くケースの数、各ライン整数m(^ 71≤m≤10)を表します。
出力
これらの数値の階乗出力ビット。
サンプル入力コピー
2
10
20は、
コピー出力例
。7
。19
#include <iostream>
#include <cstdio>
#include <queue>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
using namespace std;
const int M = 100005;
long long count(int x){
long long ans = 1;
double k = 1.0;
for(int i=1; i<=x; i++){
k *= i;
while(k>=10){
ans++;
k/=10;
}
}
return ans;
}
int main()
{
int n,m;
cin >> n;
while(n--){
cin >> m;
cout << count(m) << endl;
}
return 0;
}