IT民工
加油!
摘要: 这道题类似于哈夫曼树,每次切付出的代价等于长度,所以我们要将长的先截出来。而题目是给出N截,以及每截的长度。所以我们每次加上短的,使总代价最少。学会了优先级队列的STL写法。/*Accepted 348K 32MS C++ 644B 2012-07-30 16:32:44*/#include<cstdio>#include<cstring>#include<cstdlib>#include<queue>using namespace std;typedef long long LL;int N;LL calc(){ LL ans; int len 阅读全文
posted @ 2012-04-13 19:15 找回失去的 阅读(128) 评论(0) 推荐(0) 编辑