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

            搜索

            積分與排名

            最新隨筆

            最新評論

            閱讀排行榜

            評論排行榜

            HDOJ HDU 1060 Leftmost Digit ACM 1060 IN HDU

            Posted on 2010-08-06 14:51 MiYu 閱讀(424) 評論(0)  編輯 收藏 引用 所屬分類: ACM ( 數論 )
            MiYu原創, 轉帖請注明 : 轉載自 ______________白白の屋

            題目地址:
                    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取對數得 log10(m)=n*log10(n),得m=10^(n*log10(n)),由于10的任何整數次冪首位一定為1,所以m的首位只和n*log10(n)的小數部分有關
            代碼如下 :
                  
            //MiYu原創, 轉帖請注明 : 轉載自 ______________白白の屋

            #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;                               
            }
            人妻精品久久久久中文字幕| 精品国产一区二区三区久久久狼| 久久久久久精品无码人妻| 久久er国产精品免费观看8| 欧美熟妇另类久久久久久不卡| 日韩精品久久久久久久电影蜜臀| 久久精品国产亚洲AV高清热| 久久人做人爽一区二区三区| 色婷婷综合久久久中文字幕| 久久这里只有精品首页| 久久精品国产亚洲av影院| 国产亚洲精品久久久久秋霞 | 国产美女亚洲精品久久久综合| 亚洲人成电影网站久久| 东方aⅴ免费观看久久av| 久久青青色综合| 亚洲精品无码久久久久| 久久国产精品成人影院| 97久久精品无码一区二区| 久久精品成人免费看| 久久久久亚洲?V成人无码| 国产精品久久婷婷六月丁香| 九九久久自然熟的香蕉图片| 国产精品久久国产精品99盘| 亚洲人AV永久一区二区三区久久 | 狠狠精品久久久无码中文字幕| 久久99热狠狠色精品一区| 精品久久国产一区二区三区香蕉| 亚洲AV无码久久精品狠狠爱浪潮| 国产精品激情综合久久| 人妻丰满AV无码久久不卡| 欧美精品福利视频一区二区三区久久久精品 | 91精品日韩人妻无码久久不卡| 亚洲欧美国产精品专区久久| 一本一本久久a久久综合精品蜜桃 一本一道久久综合狠狠老 | 久久综合视频网站| 亚洲∧v久久久无码精品| 青青草原综合久久大伊人导航| 久久99精品久久久久子伦| 国产精品99久久精品爆乳| 9久久9久久精品|