• <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>
            xiaoguozi's Blog
            Pay it forword - 我并不覺的自豪,我所嘗試的事情都失敗了······習(xí)慣原本生活的人不容易改變,就算現(xiàn)狀很糟,他們也很難改變,在過程中,他們還是放棄了······他們一放棄,大家就都是輸家······讓愛傳出去,很困難,也無法預(yù)料,人們需要更細(xì)心的觀察別人,要隨時(shí)注意才能保護(hù)別人,因?yàn)樗麄兾幢刂雷约阂裁础ぁぁぁぁ?/span>

             http://acm.hdu.edu.cn/showproblem.php?pid=1525

             1 //題意: 給定n,m兩個(gè)數(shù),兩個(gè)人輪流操作:
             2 //選m,n小的數(shù),每次都是大的減去小的數(shù)的k倍,k<=max(n,m)/min(n,m);
             3 //知道其中一個(gè)為0時(shí),執(zhí)行該操作的為勝者
             4 
             5 //Analyse:for example: if n>m,then n=m*k+c(k<=n/m,c=n%m)
             6 //if k>1,then the first player can decide who'll win.if current statue is lost,he can decrease (k-1)*m,
             7 //the statue is changed to (m+c,m),the second player only operate m,so the statue is changed to (m,c) which
             8 //is the winning statue. if current is the winning statue,he can decrease k*m,the statue is changed to (m,c)
             9 //which is the lost statue.So if k>1,the one who operate it is the winner,he is active.but if k==1,he can only
            10 //operate the small one.the one who first meet k>1 is the winner.specially,if no one meet k>1,the player operate
            11 //it in turn,the first makes the n or m to zero is the winner.
            12 #include <iostream>
            13 
            14 using namespace std;
            15 int main()
            16 {
            17     int n,m;
            18     while(cin>>n>>m,n+m){
            19         int cnt=0;
            20         int ans=0;
            21         while(1){
            22             if(n<m)swap(n,m);
            23             ans=n/m;
            24             if(ans>=2){
            25                 break;
            26             }
            27             cnt++;
            28             n%=m;
            29             if(n==0){
            30                 cnt++;
            31                 break;
            32             }                
            33         }
            34         if(cnt&1){
            35             cout<<"Ollie wins\n";
            36         }
            37         else cout<<"Stan wins\n";
            38     }
            39     return 0;
            40 }
            posted on 2008-07-23 18:55 小果子 閱讀(262) 評(píng)論(0)  編輯 收藏 引用

            只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            久久免费小视频| 久久久无码精品亚洲日韩软件| 国产日韩欧美久久| 久久精品国产亚洲77777| 亚洲人成无码www久久久| 国产精品一久久香蕉国产线看| 久久久久久久女国产乱让韩| 精品综合久久久久久88小说 | 亚洲AV无码久久精品狠狠爱浪潮| 久久精品中文字幕有码| 欧美伊香蕉久久综合类网站| 久久国产精品成人影院| 日韩av无码久久精品免费| 伊人久久大香线焦AV综合影院 | 精品久久亚洲中文无码| 久久久久亚洲AV无码专区首JN| 伊人久久大香线蕉精品不卡| 久久久久国产精品麻豆AR影院 | 久久人人添人人爽添人人片牛牛 | 久久久噜噜噜久久中文字幕色伊伊 | 亚洲人成网亚洲欧洲无码久久 | 久久久国产乱子伦精品作者| 久久ZYZ资源站无码中文动漫| 久久er99热精品一区二区| 久久精品这里热有精品| 久久99免费视频| 久久亚洲国产精品123区| 亚洲国产视频久久| 久久天天躁狠狠躁夜夜2020一 | 久久国产精品-久久精品| 97超级碰碰碰碰久久久久| 国产精品成人久久久久三级午夜电影| 国产69精品久久久久99| 一97日本道伊人久久综合影院| 97精品依人久久久大香线蕉97 | 蜜桃麻豆www久久| 久久久久久久亚洲精品| 一本一本久久A久久综合精品| 国产亚洲美女精品久久久久狼| 久久99精品九九九久久婷婷| 偷偷做久久久久网站|