• <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 閱讀(412) 評論(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 
            久久亚洲AV无码西西人体| 亚洲人成精品久久久久| 手机看片久久高清国产日韩| 亚洲七七久久精品中文国产| 久久无码人妻一区二区三区| 国内精品久久久久影院网站| 97精品伊人久久大香线蕉app| 欧美日韩中文字幕久久久不卡| 色狠狠久久综合网| 亚洲国产成人精品无码久久久久久综合| 久久一区二区三区99| 无码AV波多野结衣久久| 久久www免费人成精品香蕉| 亚洲第一极品精品无码久久| 国产成人久久精品麻豆一区| 久久国产亚洲精品无码| 少妇久久久久久被弄高潮| 狠狠精品久久久无码中文字幕 | 国内精品人妻无码久久久影院导航 | 青青草国产97免久久费观看| 久久精品aⅴ无码中文字字幕重口| 久久综合综合久久狠狠狠97色88| 99久久国语露脸精品国产| 色综合合久久天天给综看| 精品综合久久久久久97超人| 日本久久久精品中文字幕| 亚洲精品国产美女久久久| yy6080久久| 久久久国产精品亚洲一区| 狠狠色丁香婷婷久久综合| 久久久精品视频免费观看| 人人狠狠综合久久亚洲| 精品乱码久久久久久夜夜嗨| 久久免费视频观看| 97久久精品人人澡人人爽| 久久青青草原精品国产软件| 超级碰久久免费公开视频| 久久综合欧美成人| 久久99精品免费一区二区| 久久久综合香蕉尹人综合网| 久久露脸国产精品|