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

            我希望你是我獨家記憶

            一段永遠封存的記憶,隨風而去
            posts - 263, comments - 31, trackbacks - 0, articles - 3
               :: 首頁 :: 新隨筆 ::  :: 聚合  :: 管理

            SRM144DIV1

            Posted on 2009-06-23 16:39 Hero 閱讀(125) 評論(0)  編輯 收藏 引用 所屬分類: 代碼如詩--ACM
             1 #include <iostream>
             2 #include <vector>
             3 #include <string>
             4 #include <algorithm>
             5 using namespace std ;
             6 
             7 class BinaryCode
             8 {
             9 public:
            10     vector<string> decode( string message )
            11     {
            12         vector<string> revec ; 
            13         revec.clear() ;
            14 
            15         int num[100= {0} ; 
            16         forint i=0; i<message.length(); i++ )
            17         {
            18             num[i+1= message[i] - '0' ;
            19         }
            20 
            21         int ans[100= {0} ;
            22         //case 1 :
            23         ans[1= 0 ; bool none = false ;
            24         forint i=2; i<=message.length(); i++ )
            25         {
            26             ans[i] = num[i-1- ans[i-1- ans[i-2] ;
            27             if( ans[i] < 0 || ans[i] > 1 ) none = true ;
            28         }
            29 
            30         int final = message.length() ;
            31         if( num[final] != ans[final-1+ ans[final] || none )
            32         {
            33             //revec[0] = "NONE" ;
            34             revec.push_back( "NONE" ) ;
            35         }
            36         else
            37         {
            38             string str ; str.clear() ;
            39             forint i=1; i<=message.length(); i++ )
            40             {
            41                 str += (ans[i]+'0') ;
            42             }
            43             revec.push_back( str ) ;
            44         }
            45 
            46         //case 2 :
            47         ans[1= 1 ; none = false ;
            48         forint i=2; i<=message.length(); i++ )
            49         {
            50             ans[i] = num[i-1- ans[i-1- ans[i-2] ;
            51             if( ans[i] < 0 || ans[i] > 1 ) none = true ;
            52         }
            53 
            54         final = message.length() ;
            55         if( num[final] != ans[final-1+ ans[final] || none )
            56         {
            57             revec.push_back( "NONE" ) ;
            58         }
            59         else
            60         {
            61             string str ; str.clear() ;
            62             forint i=1; i<=message.length(); i++ )
            63             {
            64                 str += (ans[i]+'0') ;
            65             }
            66             revec.push_back( str ) ;
            67         }
            68 
            69         return revec ;
            70     }
            71 };
            72 
            73 int main()
            74 {
            75     string inn ;
            76     while( cin >> inn )
            77     {
            78         BinaryCode *bin = new BinaryCode() ;
            79 
            80         vector<string> vec = bin->decode( inn ) ;
            81 
            82         cout << vec[0<< endl ;
            83         cout << vec[1<< endl ;
            84     }
            85     return 0 ;
            86 }
            久久国产精品免费一区| 久久久精品波多野结衣| 奇米影视7777久久精品人人爽| 性欧美丰满熟妇XXXX性久久久| 久久久精品免费国产四虎| 中文字幕精品无码久久久久久3D日动漫 | 99精品久久久久久久婷婷| 久久久久久曰本AV免费免费| 国产高清美女一级a毛片久久w | 狠狠色婷婷综合天天久久丁香| 模特私拍国产精品久久| 色综合合久久天天综合绕视看| 国产精品99久久久久久董美香| 亚洲国产天堂久久综合| 99久久综合狠狠综合久久止| 久久综合狠狠综合久久| 模特私拍国产精品久久| 2021精品国产综合久久| 久久久这里只有精品加勒比| 久久精品国产一区| 亚洲AV无码久久精品狠狠爱浪潮| 久久婷婷国产麻豆91天堂| 久久亚洲日韩看片无码| 国产亚洲美女精品久久久久狼| 久久无码AV中文出轨人妻| 亚洲一本综合久久| 狠狠色丁香婷综合久久| 奇米影视7777久久精品| 免费精品久久天干天干| 久久综合视频网| 亚洲国产精品成人久久蜜臀| 99久久免费只有精品国产| 久久99精品国产麻豆宅宅 | 久久精品国产亚洲精品2020 | 狠狠色综合网站久久久久久久| 无码国内精品久久人妻| 亚洲欧洲日产国码无码久久99| 一级做a爰片久久毛片看看 | 国产成人久久精品一区二区三区| 久久er99热精品一区二区| 性欧美丰满熟妇XXXX性久久久|