摘要: http://poj.org/problem?id=2442题意:给出m个序列,每个序列有n个数,从每个序列中选择一个数相加,总共有n^m个数,输出这些数中最小的n个数;思路:用的是stl中的heap(堆)从上到下层层维护堆,堆的复杂度为nlogn;代码:View Code #include <cstdio>#include <iostream>#include <algorithm>using namespace std;int a[2010] = {0};int b[2010] = {0};int heap[2010] = {0};int main(){ 阅读全文
posted @ 2012-03-26 20:42 LT-blogs 阅读(358) 评论(2) 推荐(0) 编辑