• <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;                               
            }
            国产成人无码精品久久久性色| 色狠狠久久AV五月综合| 久久综合狠狠综合久久激情 | 国产成人精品久久一区二区三区av| 久久久中文字幕| 久久成人小视频| 99久久99这里只有免费的精品| 久久国产成人午夜aⅴ影院| 亚洲日本va午夜中文字幕久久| 久久精品国产亚洲av日韩| 国产精品亚洲美女久久久| 久久SE精品一区二区| 久久久精品无码专区不卡| 久久青青草原精品国产软件| 99久久精品午夜一区二区 | 国产精品丝袜久久久久久不卡 | 国产亚洲精品久久久久秋霞 | 久久se精品一区二区| 国内精品伊人久久久影院| 亚洲欧洲久久av| 一本色道久久综合狠狠躁篇 | 久久国产福利免费| 久久久久亚洲精品无码蜜桃| 国内精品久久久久久野外| 国内精品久久久久久久久电影网| 久久久久国产一级毛片高清板| 久久精品国产日本波多野结衣| 99久久国产综合精品麻豆| 午夜肉伦伦影院久久精品免费看国产一区二区三区 | 久久久久人妻一区二区三区| 亚洲va中文字幕无码久久| 久久99精品国产99久久6| 午夜人妻久久久久久久久| 久久一区二区三区免费| 2022年国产精品久久久久| 日本久久中文字幕| 久久久久久久尹人综合网亚洲| 久久久久久久久66精品片| 99久久久久| 久久青青草原亚洲av无码app| 久久久久亚洲av毛片大|