文章出處

題目:

Description

In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you have to determine the number of digits in the factorial of the number.

Input

Input consists of several lines of integer numbers. The first line contains an integer n, which is the number of cases to be tested, followed by n lines, one integer 1 <= m <= 10^7 on each line.

Output

The output contains the number of digits in the factorial of the integers appearing in the input.

Sample Input

21020

Sample Output

719

有個題目和這個是一樣的點擊打開鏈接

但是這個題目m比較大,所以不能再用數組來求了。

這個題目,可以用斯特林公式。

\

代碼:

#include#includeusing namespace std;int main(){int t, n;cin >> t;while (t--){cin >> n;cout << int(log10(2 * acos(-1.0)*n) / 2 + (log10(n) - 1 / log(10))*n + 1 / log(10) / n / 12)+1<   ;>

就愛閱讀www.92to.com網友整理上傳,為您提供最全的知識大全,期待您的分享,轉載請注明出處。
歡迎轉載:http://www.kanwencang.com/bangong/20161116/54176.html

文章列表




Avast logo

Avast 防毒軟體已檢查此封電子郵件的病毒。
www.avast.com


arrow
arrow
    全站熱搜
    創作者介紹
    創作者 大師兄 的頭像
    大師兄

    IT工程師數位筆記本

    大師兄 發表在 痞客邦 留言(0) 人氣()