• <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>

            ACM___________________________

            ______________白白の屋
            posts - 182, comments - 102, trackbacks - 0, articles - 0
            <2010年8月>
            25262728293031
            1234567
            891011121314
            15161718192021
            22232425262728
            2930311234

            常用鏈接

            留言簿(24)

            隨筆分類(332)

            隨筆檔案(182)

            FRIENDS

            搜索

            積分與排名

            最新隨筆

            最新評論

            閱讀排行榜

            評論排行榜

            MiYu原創(chuàng), 轉(zhuǎn)帖請注明 : 轉(zhuǎn)載自 ______________白白の屋

            題目地址:
                    http://acm.hdu.edu.cn/showproblem.php?pid=1060
            題目描述:
            Problem Description
            Given a positive integer N, you should output the leftmost digit of N
            ^N.
             

            Input
            The input contains several test cases. The first line of the input 
            is a single integer T which is the number of test cases. T test cases follow.
            Each test 
            case contains a single positive integer N(1<=N<=1,000,000,000).
             

            Output
            For each test 
            case, you should output the leftmost digit of N^N.
             

            Sample Input
            2
            3
            4
             

            Sample Output
            2
            2

            解題思路:
                     m=n^n,兩遍分別對10取對數(shù)得 log10(m)=n*log10(n),得m=10^(n*log10(n)),由于10的任何整數(shù)次冪首位一定為1,所以m的首位只和n*log10(n)的小數(shù)部分有關(guān)
            代碼如下 :
                  
            //MiYu原創(chuàng), 轉(zhuǎn)帖請注明 : 轉(zhuǎn)載自 ______________白白の屋

            #include 
            <iostream>
            #include 
            <cmath>
            using namespace std;
            typedef 
            long long int64; 
            int main()
            {
                int64 N,i,a,sum;
                
            double s,num,x;
                cin 
            >> N;
                
            while ( N -- )
                {
                   cin 
            >> num;
                   s 
            = num * log10 ( num );
                   a 
            = ( int64 ) s;
                   x 
            = s - a;
                   sum 
            = ( int64 ) pow ( ( double ) 10, ( x ) );
                   cout 
            << sum << endl;
                }
                
            return 0;                               
            }
            韩国免费A级毛片久久| 亚洲AV无一区二区三区久久| 久久久无码一区二区三区| 无码超乳爆乳中文字幕久久| 一本久久a久久精品vr综合| 久久男人Av资源网站无码软件| 久久777国产线看观看精品| 久久综合综合久久97色| 亚洲日本va午夜中文字幕久久| 亚洲色欲久久久综合网| 国产精品日韩深夜福利久久| 亚洲人成伊人成综合网久久久| 国产精品岛国久久久久| 久久久久亚洲国产| 久久青青草原精品影院| 伊人久久大香线蕉av一区| 久久久久中文字幕| 亚洲人成网亚洲欧洲无码久久| 99久久亚洲综合精品成人| 久久精品99久久香蕉国产色戒| 久久久久免费精品国产| 亚洲熟妇无码另类久久久| 色综合合久久天天给综看| 精品综合久久久久久97超人| 久久精品无码专区免费东京热| 久久久这里有精品中文字幕| 久久国产高清字幕中文| 久久久国产精品亚洲一区| 久久精品国产亚洲AV影院| 欧美麻豆久久久久久中文| 9999国产精品欧美久久久久久| 久久精品天天中文字幕人妻| 97精品伊人久久久大香线蕉| 久久久无码精品亚洲日韩软件| 精品综合久久久久久88小说| 久久午夜电影网| 伊人久久大香线焦综合四虎| 国内精品久久久久影院免费| 97久久国产亚洲精品超碰热| 大伊人青草狠狠久久| 国产V综合V亚洲欧美久久|