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

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

            Section 3.1 - Contact

            Posted on 2009-04-28 09:34 superman 閱讀(88) 評論(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 
            国产成人精品免费久久久久| 久久婷婷五月综合成人D啪| 日韩精品久久久久久免费| 久久精品亚洲精品国产色婷| 久久综合丝袜日本网| 亚洲欧美国产精品专区久久 | 久久精品国产69国产精品亚洲| 亚洲天堂久久精品| 狠狠色综合网站久久久久久久高清| 精品国产91久久久久久久 | 久久久精品人妻一区二区三区蜜桃| 一本色道久久88精品综合 | 国内精品人妻无码久久久影院导航| 77777亚洲午夜久久多喷| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 久久综合久久美利坚合众国| 久久久九九有精品国产| 精品国产乱码久久久久久呢| 久久久久久免费一区二区三区| 伊人久久精品无码二区麻豆| 国产精品九九久久免费视频 | 亚洲国产婷婷香蕉久久久久久| 99久久精品国产麻豆| 亚洲综合日韩久久成人AV| 久久激情亚洲精品无码?V| 99久久国语露脸精品国产| 亚洲αv久久久噜噜噜噜噜| 久久丝袜精品中文字幕| 久久精品女人天堂AV麻| 91久久国产视频| 99久久精品费精品国产| 91精品国产综合久久香蕉| 久久中文字幕一区二区| 日本久久久久久中文字幕| 久久99国产精品久久| 国产精品久久久久9999高清| 久久精品中文闷骚内射| 97久久超碰国产精品2021| 久久综合中文字幕| 久久精品亚洲福利| 2020久久精品亚洲热综合一本|