• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            斯特靈公式是一條用來取n階乘近似值數(shù)學(xué)公式。一般來說,當(dāng)n很大的時候,n階乘的計算量十分大,所以斯特靈公式十分好用,而且,即使在

             

            n很小的時候,斯特靈公式的取值已經(jīng)十分準(zhǔn)確。

            公式為:

            這就是說,對于足夠大的整數(shù)n,這兩個數(shù)互為近似值。更加精確地:

            或者:

             

             

            Big Number

            Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
            Total Submission(s): 8759    Accepted Submission(s): 3879


            Problem 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 ≤ n ≤ 107 on each line.
             
            Output
            The output contains the number of digits in the factorial of the integers appearing in the input.
             
            Sample Input
            2 10 20
            Sample Output
            7 19
            //log10(n!)=(0.5*log(2*PI*n)+n*log(n)-n)/log(10)

            #include 
            <iostream>
            #include 
            <cstdio>
            #include 
            <cmath>

            const double PI = 3.1415926;

            int main()
            {
                
            int n;
                
            int tmp;
                
            while~scanf("%d"&n ) )
                
            {
                    
            forint i = 0; i < n; i++ )
                    
            {
                        scanf(
            "%d"&tmp);
                        
            double cnt = 1;
                        cnt 
            += (0.5 * log( 2 * PI * tmp ) + tmp * log( tmp ) - tmp ) / log(10);
                        printf(
            "%d\n", (int)(cnt));
                    }

                }

                
            return 0;
            }

            posted on 2010-10-02 14:22 Vontroy 閱讀(774) 評論(0)  編輯 收藏 引用 所屬分類: 數(shù)論HDU
            久久99国产精品久久久| 99久久er这里只有精品18| 51久久夜色精品国产| 9久久9久久精品| 免费一级欧美大片久久网| 久久人妻AV中文字幕| 国产精品久久久亚洲| 日韩美女18网站久久精品| 国产精品久久午夜夜伦鲁鲁| 亚洲国产另类久久久精品黑人| 久久久免费精品re6| 久久久久久青草大香综合精品| 亚洲а∨天堂久久精品| 国产精品久久久久久影院| 国产激情久久久久影院老熟女| 亚洲国产天堂久久久久久| 成人国内精品久久久久一区| 69久久精品无码一区二区| 久久久精品人妻无码专区不卡| 99精品国产综合久久久久五月天| 国产高清美女一级a毛片久久w| 性做久久久久久久| 伊人色综合久久天天人手人婷| 久久久噜噜噜久久熟女AA片| 伊人久久大香线蕉综合网站| 亚洲欧美国产精品专区久久| 亚洲国产成人精品91久久久| 理论片午午伦夜理片久久 | 色综合久久久久综合体桃花网| 国产成人精品久久亚洲高清不卡 | 婷婷伊人久久大香线蕉AV| 欧洲人妻丰满av无码久久不卡| 久久久无码精品亚洲日韩蜜臀浪潮| 久久综合成人网| 久久夜色精品国产欧美乱| 2021精品国产综合久久| 国内精品久久久久久久久| 亚洲中文字幕久久精品无码喷水 | 亚洲AV无码久久| 久久91精品国产91久久户| 一本一本久久a久久精品综合麻豆|