• <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階乘近似值數學公式。一般來說,當n很大的時候,n階乘的計算量十分大,所以斯特靈公式十分好用,而且,即使在

             

            n很小的時候,斯特靈公式的取值已經十分準確。

            公式為:

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

            或者:

             

             

            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 閱讀(764) 評論(0)  編輯 收藏 引用 所屬分類: 數論HDU
            中文字幕久久精品无码| 亚洲日韩中文无码久久| 国产精品岛国久久久久| 91久久精品国产免费直播| 久久久一本精品99久久精品66| 91精品国产高清久久久久久国产嫩草 | 一级做a爰片久久毛片看看| 久久夜色精品国产欧美乱| 人妻中文久久久久| 久久性生大片免费观看性| 国产精品青草久久久久福利99| 久久午夜伦鲁片免费无码| 国内精品欧美久久精品| 久久国产精品一区| 九九热久久免费视频| 欧洲成人午夜精品无码区久久| 久久精品成人免费国产片小草| 久久99精品综合国产首页| 国产精品久久亚洲不卡动漫| 精品国产99久久久久久麻豆| 伊人久久大香线蕉综合热线| 久久亚洲中文字幕精品一区| 99久久夜色精品国产网站| 久久久久国产精品三级网| 国产精品美女久久久m| 爱做久久久久久| 精品国产乱码久久久久久1区2区| 国产美女亚洲精品久久久综合 | 久久久精品午夜免费不卡| 国产成人无码精品久久久免费| 亚洲中文字幕无码久久精品1| 色欲综合久久躁天天躁| 精品99久久aaa一级毛片| 99久久精品免费看国产免费| 久久精品免费一区二区三区| 狠狠色丁香久久婷婷综合五月| 国内精品久久久久影院优| 久久99国产精品99久久| 国产A级毛片久久久精品毛片| 国产精品日韩深夜福利久久| 久久午夜无码鲁丝片午夜精品|