• <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 1183 - Scheduling Lectures

            Posted on 2008-04-17 23:14 superman 閱讀(414) 評論(0)  編輯 收藏 引用 所屬分類: ZOJ

            set opt[i][j] for the the min time of using i lessons cover the 1..j topics.
                opt[i][j] = min{ opt[i - 1][j - k] + d(j - k + 1 .. j) }

             1 /* Accepted 1183 C++ 00:01.91 4760K */
             2 #include <iostream>
             3 
             4 using namespace std;
             5 
             6 int main()
             7 {
             8     int N;
             9     cin >> N;
            10     while(N--)
            11     {
            12         int n, l, c, t[1001], Case = 0,;
            13         cin >> n;
            14         while(n)
            15         {
            16             cin >> l >> c;
            17             for(int i = 1; i <= n; i++)
            18                 cin >> t[i];
            19             
            20             int d[1001][1001];
            21             for(int i = 0; i <= n; i++)
            22             for(int j = 0; j <= n; j++)
            23                 d[i][j] = INT_MAX;
            24             
            25             d[0][0= 0;
            26             
            27             int i;
            28             for(i = 0; i < n; i++)
            29             {
            30                 if(d[i][n] != INT_MAX)
            31                     break;
            32                 
            33                 for(int j = i; j < n; j++)
            34                 {
            35                     if(d[i][j] == INT_MAX)
            36                         break;
            37                     
            38                     int x = l;
            39                     for(int k = j + 1; k <= n; k++)
            40                     {
            41                         x -= t[k];
            42                         if(x < 0)
            43                             break;
            44                         
            45                         if(x == 0)
            46                             d[i + 1][k] <?= d[i][j];
            47                         else if(1 <= x && x <= 10)
            48                             d[i + 1][k] <?= d[i][j] - c;
            49                         else if(x > 10)
            50                             d[i + 1][k] <?= d[i][j] + (x - 10* (x - 10);
            51                     }
            52                 }
            53             }
            54             
            55             cout << "Case " << ++ Case << ':' << endl << endl;
            56             cout << "Minimum number of lectures: " << i << endl;
            57             cout << "Total dissatisfaction index: " << d[i][n] << endl;
            58             
            59             cin >> n;
            60             if(n)
            61                 cout << endl;
            62         }
            63         if(N)
            64             cout << endl;
            65     }
            66     
            67     return 0;
            68 }
            69 
            久久99久久无码毛片一区二区| 天天影视色香欲综合久久| 久久人人爽人人爽人人AV东京热| 香蕉久久影院| WWW婷婷AV久久久影片| 国产毛片久久久久久国产毛片| 久久久99精品一区二区| 色欲综合久久中文字幕网| 91精品国产91久久久久久| 97香蕉久久夜色精品国产| 久久久久久综合一区中文字幕| 中文字幕无码久久久| 大伊人青草狠狠久久| 久久久亚洲AV波多野结衣| 亚洲一区二区三区日本久久九| 99精品久久精品一区二区| 九九久久精品国产| 婷婷综合久久中文字幕蜜桃三电影| 国产精品免费久久久久电影网| 欧美牲交A欧牲交aⅴ久久 | 欧美久久综合性欧美| 狠狠色丁香婷婷久久综合五月| 久久免费高清视频| 久久天堂AV综合合色蜜桃网| 免费一级欧美大片久久网 | 国产精品美女久久久免费| 亚洲午夜久久久久久噜噜噜| 亚洲精品99久久久久中文字幕| 97超级碰碰碰碰久久久久| 国产精品一久久香蕉产线看| 中文字幕无码精品亚洲资源网久久 | 国产—久久香蕉国产线看观看| 久久国产精品一国产精品金尊| 久久久久久久综合狠狠综合| 亚洲AⅤ优女AV综合久久久| 国产69精品久久久久99尤物| 青草影院天堂男人久久| 国产精品美女久久久久av爽 | 国产91久久综合| 久久久精品久久久久久| 国产福利电影一区二区三区久久老子无码午夜伦不 |