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

            ZOJ 1093 - Monkey and Banana

            Posted on 2008-03-23 17:25 superman 閱讀(272) 評論(0)  編輯 收藏 引用 所屬分類: ZOJ
             1 /* Accepted 1093 C++ 00:00.01 848K */
             2 #include <stdlib.h>
             3 #include <iostream>
             4 
             5 using namespace std;
             6 
             7 struct Rect { int a, b, height; } rect[100];
             8 
             9 int cmp(const void * a, const void * b)
            10 {
            11     Rect * c = (Rect*)(a);
            12     Rect * d = (Rect*)(b);
            13     if(c -> a == d -> a)
            14         return c -> b - d -> b;
            15     return c -> a - d -> a;
            16 }
            17 
            18 void swap(int & a, int & b)
            19 {
            20     a = a ^ b;
            21     b = a ^ b;
            22     a = a ^ b;
            23 }
            24 
            25 int main()
            26 {
            27     int Case = 0, n;
            28     while((cin >> n) && n)
            29     {
            30         int x, y, z, count = 0;
            31         for(int i = 0; i < n; i++)
            32         {
            33             cin >> x >> y >> z;
            34             count++; rect[count].a = x; rect[count].b = y; rect[count].height = z;
            35             count++; rect[count].a = x; rect[count].b = z; rect[count].height = y;
            36             count++; rect[count].a = y; rect[count].b = z; rect[count].height = x;
            37         }
            38         
            39         for(int i = 1; i <= count; i++)
            40             if(rect[i].a > rect[i].b)
            41                 swap(rect[i].a, rect[i].b);
            42         
            43         qsort(rect + 1, count, sizeof(Rect), cmp);
            44         
            45         int opt[100= {0};
            46         opt[1= rect[1].height;
            47         for(int i = 2; i <= count; i++)
            48         {
            49             for(int j = 1; j < i; j++)
            50                 if(rect[i].a > rect[j].a && rect[i].b > rect[j].b)
            51                     opt[i] >?= opt[j];
            52             opt[i] += rect[i].height;
            53         }
            54         
            55         int max = 0;
            56         for(int i = 1; i <= count; i++)
            57             max >?= opt[i];
            58         cout << "Case " << ++Case << ": maximum height = " << max << endl;
            59     }
            60     
            61     return 0;
            62 }
            63 
            久久这里有精品视频| 久久久精品久久久久影院| 97热久久免费频精品99| 久久精品国产清高在天天线| 国产精品美女久久久久| 情人伊人久久综合亚洲| 久久综合综合久久狠狠狠97色88| 久久播电影网| 日产精品99久久久久久| 久久九九兔免费精品6| 久久精品国产亚洲AV香蕉| 久久综合久久综合九色| 久久大香萑太香蕉av| 99久久久精品| 久久中文字幕人妻熟av女| 91精品日韩人妻无码久久不卡| 99久久精品免费看国产一区二区三区| 日本久久久精品中文字幕| 伊人久久大香线蕉综合Av| 久久综合九色欧美综合狠狠 | 九九久久精品国产| 精产国品久久一二三产区区别| 欧美777精品久久久久网| 久久久久久伊人高潮影院| 久久97久久97精品免视看秋霞 | 国产V综合V亚洲欧美久久| 久久亚洲高清综合| 国产精品免费久久久久影院| 久久亚洲精品国产精品| 久久久SS麻豆欧美国产日韩| 色8激情欧美成人久久综合电| A级毛片无码久久精品免费| 久久精品国产亚洲AV高清热 | 久久777国产线看观看精品| 久久九九兔免费精品6| 久久无码中文字幕东京热| 亚洲国产天堂久久综合| 久久久久亚洲AV成人网人人软件| 一本久久久久久久| 久久久精品久久久久久 | 久久精品国产第一区二区|