HDU1018(也是水题)

来源:互联网 发布:武汉破获一起新型网络 编辑:程序博客网 时间:2024/06/05 06:23

HDU1018
今天,第四道水题了

#include <cstdio>#include <iostream>#include <cstdlib>#include <cmath>#include <cstring>#include <string>#include <map>#include <stack>#include <queue>#include <vector>#include <algorithm>using namespace std;#define lson rt<<1#define rson rt<<1 | 1#define Mid ( (L+R) >> 1 )#define debug(x) cout<<#x<<":"<<(x)<<endl;#define Pause system("pause");#define RF freopen("1.txt", "r", stdin);#define WF freopen("11.txt", "w", stdout);#define QCIN ios::sync_with_stdio(false);int dir[4][2] = {{0,1},{0,-1},{1,0},{-1,0}};int main(){    // RF    int t,n;    double ans;    cin >> t;    while( t-- ){        cin >> n;        ans = 0;        for(int i=1; i<=n; i++)            ans += log10(i);        cout << (int)ans+1 << endl;    }    return 0;}// log10( n * n-1 * n-2 * ... * 3 * 2 * 1) + 1 = log10(n!) + 1
0 0