题干:
蒜头君对阶乘产生了兴趣,他列出了前 1010 个正整数的阶乘以及对应位数的表:
| nn | n!n! | 位数 | 
|---|---|---|
| 1 | 1 | 1 | 
| 2 | 2 | 1 | 
| 3 | 6 | 1 | 
| 4 | 24 | 2 | 
| 5 | 120 | 3 | 
| 6 | 720 | 3 | 
| 7 | 5040 | 4 | 
| 8 | 40320 | 5 | 
| 9 | 362880 | 6 | 
| 10 | 3628800 | 7 | 
对于蒜头君来说,再往后就很难计算了。他试图寻找阶乘位数的规律,但是失败了。现在请你帮他计算出第一个正整数的阶乘位数大于等于 1000010000 的数是多少,即求最小的正整数 nn 满足 n!n! 的位数大于等于 1000010000。
样例输入复制
无  样例输出复制
无  
解题报告:
阶乘问题考虑取对数。(证明不写了比较简单、、)
AC代码:
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
#define fi first
#define se second
using namespace std;
const int MAX = 2e5 + 5;
int main() 
{
    double x = 0;
    for (int i = 1;; i++) {
        x += log10(i);
        if (x >= 9999) {
            cout << i << endl;
            break;
        }
    }
    return 0;
}  



京公网安备 11010502036488号