• <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
               :: 首頁 :: 新隨筆 ::  :: 聚合  :: 管理

            P3080——枚舉

            Posted on 2008-09-02 16:28 Hero 閱讀(96) 評論(0)  編輯 收藏 引用 所屬分類: 代碼如詩--ACM
             1 //3080 Accepted 332K 0MS G++ 1415B PKU
             2 
             3 //暴力枚舉
             4 
             5 #include <stdio.h>
             6 #include <string.h>
             7 #include <stdlib.h>
             8 
             9 char data[15][70] ;
            10 char sub[70] ;
            11 
            12 char out[10000][70] ;
            13 int ctout ;
            14 
            15 int innum ;
            16 int inn ;
            17 
            18 void input()
            19 {
            20     scanf( "%d"&inn ) ;
            21     forint i=1; i<=inn; i++ ) 
            22     {
            23         scanf( "%s", data[i] ) ;
            24         //printf( "%s\n", data[i] ) ;
            25     }
            26 }
            27 
            28 int cmp( const void *a, const void *b ) 
            29 {
            30     return strcmp( (char *)a, (char *)b ) ;
            31 }
            32 
            33 bool test()
            34 {
            35     char *psub ;
            36     forint i=2; i<=inn; i++ )
            37     {
            38         psub = strstr( data[i], sub ) ;
            39         if( NULL == psub )    return false ;
            40     }
            41 
            42     return true ;
            43 }
            44 
            45 void process()
            46 {
            47     int len = 60 ; ctout = 0 ; bool hasone = false ;
            48     forint clen=len; clen>=3; clen-- )
            49     {
            50         hasone = false ;
            51 
            52         forint sn=0; sn+clen<=len; sn++ )
            53         {
            54             int sublen = 0 ;
            55             forint i=sn; i<sn+clen; i++ ) sub[sublen++= data[1][i] ;
            56             sub[sublen] = '\0' ;//枚舉子串sub
            57 
            58             iffalse == test() ) continue ;
            59             else
            60             {
            61                 hasone = true ;
            62                 strcpy( out[ctout++], sub ) ;
            63             }
            64         }
            65 
            66         if( hasone ) break ;
            67     }
            68 
            69     iffalse == hasone )
            70     {
            71         printf( "no significant commonalities\n" ) ;
            72     }
            73     else
            74     {
            75         qsort( out, ctout, sizeof(out[0]), cmp ) ;
            76         printf( "%s\n"out[0] ) ;
            77     }
            78 }
            79 
            80 
            81 int main()
            82 {
            83     //freopen( "in.txt", "r", stdin ) ;
            84 
            85     while( scanf( "%d"&innum ) != EOF )
            86     {
            87         forint ct=1; ct<=innum; ct++ )
            88         {
            89             input() ;
            90 
            91             process() ;
            92 
            93             //output() ;
            94         }
            95     }
            96 
            97     return 0 ;
            98 }
            国产成人精品白浆久久69| 久久久亚洲裙底偷窥综合| 99久久无色码中文字幕人妻| 久久人人爽人人精品视频| 亚洲狠狠综合久久| 国产成人综合久久精品尤物| 九九久久自然熟的香蕉图片| 久久亚洲私人国产精品vA| 久久精品中文騷妇女内射| 久久精品人人做人人爽电影蜜月| 久久精品国产亚洲AV蜜臀色欲| 久久久久久国产a免费观看黄色大片 | 色婷婷噜噜久久国产精品12p| 伊人久久大香线蕉精品| 91精品无码久久久久久五月天| 日本精品久久久久中文字幕8| 久久精品国产99久久久香蕉| 亚州日韩精品专区久久久| 狠狠色丁香久久婷婷综合| 国产产无码乱码精品久久鸭| Xx性欧美肥妇精品久久久久久| 精品久久久久久无码中文野结衣| 中文字幕无码久久精品青草| 99久久99这里只有免费的精品| 99久久精品费精品国产| 国产69精品久久久久观看软件| 久久久久久久久久久久中文字幕 | 伊人久久综合热线大杳蕉下载| 国产真实乱对白精彩久久| 国产精品成人久久久| 99国产精品久久久久久久成人热| 久久精品这里只有精99品| 99久久精品免费看国产一区二区三区| 97热久久免费频精品99| 伊人久久大香线蕉综合网站| 精品国产一区二区三区久久| 国内精品伊人久久久久妇| 91性高湖久久久久| 色欲久久久天天天综合网 | 欧美黑人激情性久久| 国产精品久久久久乳精品爆|