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

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

            ZOJ 1093 - Monkey and Banana

            Posted on 2008-03-23 17:25 superman 閱讀(276) 評論(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 
            2021国产精品午夜久久| 久久精品中文闷骚内射| 秋霞久久国产精品电影院| 日韩一区二区久久久久久| 久久精品成人影院| 亚洲一级Av无码毛片久久精品| 7777久久久国产精品消防器材| 国内精品久久久久影院免费| 日本久久久久久久久久| 亚洲午夜久久久久妓女影院| 久久综合久久综合九色| 欧美日韩精品久久久免费观看| 国产∨亚洲V天堂无码久久久| 亚洲国产婷婷香蕉久久久久久| 无码人妻久久一区二区三区免费丨| 日本精品久久久久中文字幕| 亚洲欧美精品一区久久中文字幕| 国产精品VIDEOSSEX久久发布| 亚洲精品无码久久久久| 久久久久国色AV免费观看| 久久精品人人做人人爽97| 一本久久综合亚洲鲁鲁五月天亚洲欧美一区二区 | 综合久久给合久久狠狠狠97色| 亚洲欧洲日产国码无码久久99| 久久久无码精品午夜| 久久精品国产69国产精品亚洲| 久久永久免费人妻精品下载| 99久久精品国产一区二区 | 新狼窝色AV性久久久久久| 国产视频久久| 久久精品无码一区二区三区日韩| 情人伊人久久综合亚洲| 久久午夜电影网| 国产精品99久久精品| 99精品久久精品| 99久久综合狠狠综合久久止| 久久精品国产亚洲欧美| 国产精品久久久久久福利69堂| 人人狠狠综合久久88成人| 久久天天躁狠狠躁夜夜躁2O2O| 国产∨亚洲V天堂无码久久久|