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

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

            ZOJ 1183 - Scheduling Lectures

            Posted on 2008-04-17 23:14 superman 閱讀(413) 評(píng)論(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 
            午夜精品久久久内射近拍高清| 久久国产香蕉视频| 超级97碰碰碰碰久久久久最新| 久久天天躁狠狠躁夜夜av浪潮| 久久性精品| 久久国产精品成人片免费| jizzjizz国产精品久久| 久久久久黑人强伦姧人妻| 久久无码高潮喷水| 久久最近最新中文字幕大全 | 久久人人爽人人爽人人片AV东京热| 思思久久精品在热线热| 俺来也俺去啦久久综合网| 久久久噜噜噜久久| 久久美女人爽女人爽| 久久人人爽人人爽人人片AV高清 | 无码人妻久久一区二区三区蜜桃| 伊人久久大香线蕉综合Av| 久久综合九色综合97_久久久| 2021国内精品久久久久久影院| 国产精品久久久久久久久| 久久国产亚洲精品| 久久青青草原精品国产软件 | 久久综合久久自在自线精品自 | 亚洲欧洲精品成人久久奇米网| 伊色综合久久之综合久久| 国产99久久久久久免费看| 久久精品国产AV一区二区三区 | 久久久精品国产sm调教网站| 91精品观看91久久久久久| 久久人妻无码中文字幕| 无码人妻久久一区二区三区蜜桃 | 99久久国产综合精品五月天喷水| 久久久久亚洲AV无码永不| 国产精品亚洲综合久久| 久久精品中文字幕一区| 91精品国产91久久久久久| 色偷偷888欧美精品久久久| 国产午夜精品久久久久免费视| 一级做a爰片久久毛片免费陪| 久久亚洲AV无码西西人体|