摘要: 题目描述Xiao Ming is a 2013-BUCTer.This time he has a Programming Contest for 2013th.So he has a lot of things to do recently.Attending classes,doing homework,programing,playing etc.In order to do things more efficient,he makes a time schedule,which has a start time and a end time,but no time of durati. 阅读全文
posted @ 2014-02-20 21:13 闪光阳 阅读(406) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 const int maxn = 10000; 4 int a[maxn][maxn]; 5 int v,e; 6 void prim(int v0) { 7 int flag[maxn] = {0}; 8 int pos; 9 flag[v0] = 1;10 for (int i = 0;i > v >> e;28 for (int i = 0;i > p >> q;30 cin >> a[p][q];31 a[q][p]=a[p][q];32 ... 阅读全文
posted @ 2014-02-20 20:30 闪光阳 阅读(256) 评论(0) 推荐(0) 编辑
摘要: //哈夫曼(最优二叉树)方法 建树//非指针做法//数据如果很大的话,有可能会超时#include #define maxn 10000+10000+3using namespace std;class T {public: int data,parent,left,right;}tree[maxn];int f[maxn] = {0};int search (int k) { int min1 = 99999999; int pos; for (int i = 0;i> n; for (int i=0; i> tree[i].data; } Huff... 阅读全文
posted @ 2014-02-20 19:17 闪光阳 阅读(429) 评论(0) 推荐(0) 编辑
摘要: //优先队列方法#include #include #define maxn 100005using namespace std;int main () { int n; long long ans = 0; int a[maxn],b[maxn]={0}; cin >> n; for (int i=0;i> a[i]; } sort (a,a+n); a[n] = 999999999; a[n+1] = 999999999; int fa=0,fb=0,ok,pos_b=0,sum; for (int i=0;i<n-1;i+... 阅读全文
posted @ 2014-02-20 10:50 闪光阳 阅读(415) 评论(0) 推荐(0) 编辑