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

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

            Section 3.1 - Contact

            Posted on 2009-04-28 09:34 superman 閱讀(99) 評論(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 
            久久久久国产精品嫩草影院| 久久人人爽人人爽人人片AV麻烦| 久久天堂AV综合合色蜜桃网| 久久精品九九亚洲精品天堂| 国产精品一久久香蕉国产线看观看 | 热99RE久久精品这里都是精品免费| 久久综合综合久久综合| 波多野结衣AV无码久久一区| 久久乐国产精品亚洲综合| 99久久夜色精品国产网站| 久久―日本道色综合久久| 久久久久国产| 99精品国产免费久久久久久下载| 久久精品国产99国产精品| 久久无码人妻一区二区三区午夜 | 久久久久久久久久久精品尤物| 精品久久久久久无码免费| 午夜精品久久久久久久无码| 久久综合亚洲鲁鲁五月天| 久久久久久久尹人综合网亚洲 | 精品久久久久久无码中文字幕 | 欧美精品国产综合久久| 久久夜色精品国产亚洲| 久久本道久久综合伊人| 久久91精品国产91久久小草 | 亚洲国产精品无码久久久蜜芽 | 久久狠狠爱亚洲综合影院| 久久久黄片| 日韩人妻无码一区二区三区久久 | 国産精品久久久久久久| 色天使久久综合网天天| 99久久精品国产麻豆| 久久亚洲AV永久无码精品| 久久久久高潮毛片免费全部播放 | 乱亲女H秽乱长久久久| 亚洲国产成人精品女人久久久 | 一本色道久久综合狠狠躁| 亚洲精品午夜国产va久久| 久久av无码专区亚洲av桃花岛| 亚洲国产精品无码久久青草| 国产精品gz久久久|