国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

【USACO】Barn Repair

2019-11-14 09:46:01
字體:
供稿:網(wǎng)友

PRoblem here

Solution

dp~~~

/*ID: LeongHouHengPROG: barn1LANG: C++ */ #include <iostream> #include <memory.h> #include <string.h> #include <fstream> #include <algorithm> using namespace std; ifstream fin("barn1.in"); ofstream fout("barn1.out"); int cows[201]; int dp[250][60]; int MIN_NUM = 2e9; int main(){ int M, S, C; fin >> M >> S >> C; for(int i = 0; i < C; i++){ fin >> cows[i]; } sort(cows, cows+C); memset(dp, 0x1f, sizeof(dp)); dp[0][0] = 1; for(int i = 1; i < C; i++){ for(int j = 0; j <= i && j < M; j++){ dp[i][j] = dp[i-1][j] + (cows[i] - cows[i-1]); if(j > 0) dp[i][j] = min(dp[i][j], dp[i-1][j-1] + 1); if(C-1 == i) MIN_NUM = min(MIN_NUM, dp[i][j]); } } fout << MIN_NUM << endl; }
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 景宁| 招远市| 正定县| 琼中| 定襄县| 平谷区| 大连市| 巴南区| 临猗县| 石屏县| 饶阳县| 彩票| 沙坪坝区| 扎囊县| 新和县| 繁昌县| 十堰市| 南华县| 石河子市| 行唐县| 鄱阳县| 岫岩| 鸡泽县| 库车县| 湖北省| 瑞昌市| 行唐县| 舞阳县| 连州市| 宁河县| 瑞丽市| 象州县| 静安区| 海林市| 亚东县| 昔阳县| 淮安市| 乌拉特前旗| 黄梅县| 乌兰浩特市| 增城市|