• <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)系 :: 聚合  :: 管理

            ZOJ 1025 - Wooden Sticks

            Posted on 2008-03-26 23:38 superman 閱讀(519) 評論(0)  編輯 收藏 引用 所屬分類: ZOJ
             1 /* Accepted 1025 C++ 00:00.16 924K */
             2 #include <string.h>
             3 #include <iostream>
             4 
             5 using namespace std;
             6 
             7 struct Stick { int l, w; } stick[5000];
             8 
             9 int cmp(const void * a, const void * b)
            10 {
            11     Stick * c = (Stick*) a;
            12     Stick * d = (Stick*) b;
            13     if(c -> l == d -> l)
            14         return c -> w - d -> w;
            15     return c -> l - d -> l;
            16 }
            17 
            18 int main()
            19 {
            20     int n;
            21     cin >> n;
            22     while(cin >> n)
            23     {
            24         for(int i = 0; i < n; i++)
            25             cin >> stick[i].l >> stick[i].w;
            26         
            27         qsort(stick, n, sizeof(Stick), cmp);
            28         
            29         bool x[5000= {0};
            30         int count = 0, m = n;
            31         while(m)
            32         {
            33             int k, curL, curW;
            34             for(k = 0; k < n; k++)
            35                 if(x[k] == 0)
            36                     break;
            37             curL = stick[k].l;
            38             curW = stick[k].w;
            39             for(int i = k; i < n; i++)
            40                 if(x[i] == 0)
            41                     if(stick[i].l >= curL && stick[i].w >= curW)
            42                     {
            43                         m--;
            44                         x[i] = 1;
            45                         curL = stick[i].l;
            46                         curW = stick[i].w;
            47                     }
            48             count++;
            49         }
            50         
            51         cout << count << endl;
            52     }
            53     
            54     return 0;
            55 }
            56 
            伊人情人综合成人久久网小说| 人妻系列无码专区久久五月天| 中文字幕久久久久人妻| 免费久久人人爽人人爽av| 久久天天婷婷五月俺也去| 亚洲精品无码久久久久久| 免费国产99久久久香蕉| 久久综合色区| av午夜福利一片免费看久久| 久久久久久久久久免免费精品| 7777精品久久久大香线蕉| 久久99毛片免费观看不卡| 伊人色综合九久久天天蜜桃| 国产精品久久久久久久久鸭 | 色综合久久88色综合天天 | 久久久久久伊人高潮影院| 四虎国产精品免费久久5151| 麻豆久久久9性大片| 国产精品免费久久久久久久久| 亚洲色欲久久久综合网| 久久久WWW成人免费精品| 国产精品久久久天天影视| 久久久SS麻豆欧美国产日韩| 久久久久噜噜噜亚洲熟女综合| 日韩久久久久久中文人妻| 噜噜噜色噜噜噜久久| 97热久久免费频精品99| 亚洲伊人久久综合中文成人网| 国产精品免费久久久久影院| 久久精品中文字幕久久| 99久久精品日本一区二区免费| 国产精品亚洲综合久久| 久久久久一本毛久久久| 国产成人无码精品久久久免费| 久久久精品午夜免费不卡| 国产精品无码久久综合| 久久国产精品无码一区二区三区 | 久久亚洲精品国产精品| 国内精品伊人久久久久777| 久久久久青草线蕉综合超碰| 久久久国产视频|