• <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 閱讀(273) 評論(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 
            欧美亚洲另类久久综合| 亚洲?V乱码久久精品蜜桃 | 精品无码人妻久久久久久| 伊人色综合久久| 久久久这里有精品中文字幕| 无夜精品久久久久久| 性做久久久久久久| 国产精品免费久久久久久久久| 亚洲精品NV久久久久久久久久| 欧洲精品久久久av无码电影| 精品久久久久久| 成人午夜精品无码区久久| 久久精品国产一区| 久久久精品国产| 99久久精品免费看国产一区二区三区| 色狠狠久久综合网| 99久久99久久精品国产片果冻| 久久精品日日躁夜夜躁欧美 | 精品久久久久久无码国产| 国内精品久久久久久久亚洲| 国产亚洲美女精品久久久2020| 丰满少妇人妻久久久久久| 久久精品国产WWW456C0M| 久久国产色AV免费观看| 亚洲欧美日韩精品久久亚洲区| 99久久精品无码一区二区毛片| 91精品国产91久久综合| 久久无码国产专区精品| 久久一区二区免费播放| 77777亚洲午夜久久多喷| 日韩精品久久无码中文字幕| 一本色道久久综合| 久久久精品久久久久影院| 久久精品国产一区二区电影| 一本大道久久a久久精品综合| 久久九九精品99国产精品| 久久久久久精品免费免费自慰| 亚洲精品午夜国产va久久| 久久91精品国产91久| 日本五月天婷久久网站| 精品久久久久久久久免费影院|