• <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
               :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

            ZOJ 1183 - Scheduling Lectures

            Posted on 2008-04-17 23:14 superman 閱讀(420) 評(píng)論(0)  編輯 收藏 引用 所屬分類(lèi): 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东京热| 久久久午夜精品| 九九精品99久久久香蕉| 东京热TOKYO综合久久精品| 97久久超碰国产精品2021| 国产精品欧美久久久久无广告| 伊人久久大香线蕉精品不卡| 久久久久国产精品人妻| 91久久精品视频| 午夜久久久久久禁播电影| 久久九九免费高清视频| 婷婷五月深深久久精品| 久久伊人五月天论坛| 久久99精品综合国产首页| 99久久综合国产精品免费 | 欧美久久一级内射wwwwww.| 麻豆AV一区二区三区久久 | 久久亚洲高清观看| 亚洲精品白浆高清久久久久久| 久久国产精品免费| 久久精品国产久精国产思思| 久久国内免费视频| 四虎亚洲国产成人久久精品| 国产99久久久久久免费看| 99久久99这里只有免费费精品| 亚洲国产视频久久| 久久综合久久伊人| 久久久WWW成人免费毛片| 国产精品久久久天天影视| 久久久久久久久无码精品亚洲日韩 | 久久久久国产精品麻豆AR影院| 久久精品一本到99热免费| 伊人久久精品无码av一区| 久久久久亚洲av综合波多野结衣| 亚洲精品综合久久| 久久久久99这里有精品10 | 国产精品99精品久久免费| 久久人妻无码中文字幕| 久久热这里只有精品在线观看| 性色欲网站人妻丰满中文久久不卡| 午夜精品久久久久久99热|