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

            superman

            聚精會神搞建設 一心一意謀發(fā)展
            posts - 190, comments - 17, trackbacks - 0, articles - 0
               :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

            Section 3.1 - Contact

            Posted on 2009-04-28 09:34 superman 閱讀(92) 評論(0)  編輯 收藏 引用 所屬分類: USACO
             1 #include <queue>
             2 #include <iostream>
             3 
             4 using namespace std;
             5 
             6 int binaryStr2num(const string & str, int s, int t)
             7 {
             8     int n = 0;
             9     for (int i = s; i < t; i++)
            10         n = n * 2 + str[i] - '0';
            11     return n;
            12 }
            13 
            14 string num2binaryStr(int k, int n)
            15 {
            16     string s;
            17     while (n)
            18     {
            19         s += (n % 2 + '0');
            20         n /= 2;
            21     }
            22     while (s.size() < k)
            23         s += '0';
            24     for (int i = 0; i < s.size() / 2; i++)
            25         swap(s[i], s[s.size() - i - 1]);
            26     return s;
            27 }
            28 
            29 int a, b, n, cnt[12 + 1][4096];
            30 string s;
            31 
            32 int main()
            33 {
            34     freopen("contact.in""r", stdin);
            35     freopen("contact.out""w", stdout);
            36 
            37     cin >> a >> b >> n;
            38 
            39     string ts;
            40     while (cin >> ts)
            41         s += ts;
            42 
            43     for (unsigned i = 0; i <= s.size() - a; i++)
            44     {
            45         int t = binaryStr2num(s, i, i + a - 1);
            46         for (int j = a; j <= b; j++)
            47         {
            48             if (i + j - 1 >= s.size())
            49                 continue;
            50             t = t * 2 + (s[i + j - 1- '0');
            51             cnt[j][t]++;
            52         }
            53     }
            54 
            55     while (n--)
            56     {
            57         int Max = 0, len, num;
            58         for (int i = a; i <= b; i++)
            59             for (int j = 0; j < 4096; j++)
            60                 if (Max < cnt[i][j])
            61                     Max = cnt[i][j], len = i, num = j;
            62 
            63         if (Max == 0)
            64             break;
            65 
            66         queue <string> q;
            67         for (int i = a; i <= b; i++)
            68             for (int j = 0; j < 4096; j++)
            69                 if (cnt[i][j] == Max)
            70                 {
            71                     q.push(num2binaryStr(i, j));
            72                     cnt[i][j] = 0;
            73                 }
            74 
            75         cout << Max << endl;
            76 
            77         int i = 0;
            78         while (q.empty() == false)
            79         {
            80             cout << q.front();
            81 
            82             i++;
            83             if (i % 6 == 0)
            84                 cout << endl;
            85             else
            86                 cout << (q.size() == 1 ? '\n' : ' ');
            87 
            88             q.pop();
            89         }
            90     }
            91 
            92     return 0;
            93 }
            94 
            AA级片免费看视频久久| 久久精品极品盛宴观看| 国产成人精品久久免费动漫| 久久亚洲高清观看| 久久无码精品一区二区三区| 99精品久久精品一区二区| av无码久久久久不卡免费网站| 久久免费线看线看| 欧美成人免费观看久久| 日韩人妻无码精品久久免费一| 久久亚洲精品视频| 久久精品国产男包| 精品国产91久久久久久久a| 久久人人爽人人人人爽AV| 成人久久精品一区二区三区| 性做久久久久久久久久久| 国产精品久久久久jk制服| 精品久久久一二三区| 久久国产精品-久久精品| 久久久噜噜噜久久中文字幕色伊伊| 国内精品久久久久久久97牛牛| 国产精品日韩欧美久久综合| 国产精品青草久久久久婷婷| 久久精品国产99久久久古代| 国内精品久久久久国产盗摄| 久久久久无码精品国产不卡| 久久亚洲精品无码VA大香大香| 热综合一本伊人久久精品| 国产一区二区精品久久岳| 99久久国产主播综合精品| www性久久久com| 国产婷婷成人久久Av免费高清 | 久久天天躁狠狠躁夜夜网站| 人妻丰满?V无码久久不卡| 欧美日韩成人精品久久久免费看| 久久se精品一区二区| 国产精品久久久久久福利漫画| 亚洲人成精品久久久久| 国产精品99久久久精品无码| 亚洲中文字幕无码久久综合网 | 久久最新免费视频|