HDU 2527】的更多相关文章

题目描述          HDU 2527 分析         霍夫曼编码的应用.         本题没有必要构造一棵完整的霍夫曼树.只需利用霍夫曼编码的原理,每次挑选频率最低的两个元素进行合并.(显然,可以利用优先级队列,这里用数组来模拟) 源码 //每次挑出现频率最小的两个元素,应该用优先级队列!!!!!!!!!! #include <stdio.h> #include <limits.h> #include <string.h> int unionFre(i…
http://acm.hdu.edu.cn/showproblem.php?pid=1053 #include <iostream> #include <cstdio> #include <algorithm> #include <cstring> #include <queue> using namespace std; ]; ]; int cal(char x){ ; ; } struct node{ int w; friend bool o…
Safe Or Unsafe Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1332    Accepted Submission(s): 524 Problem Description Javac++ 一天在看计算机的书籍的时候,看到了一个有趣的东西!每一串字符都可以被编码成一些数字来储存信息,但是不同的编码方式得到的储存空间是不一样…
Safe Or Unsafe Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1388    Accepted Submission(s): 544 Problem Description Javac++ 一天在看计算机的书籍的时候,看到了一个有趣的东西!每一串字符都可以被编码成一些数字来储存信息,但是不同的编码方式得到的储存空间是不一样…
#include<stdio.h> #include<string.h> #define N  100 #define INF  2000000000  int b[N]; char s[100001]; struct nodee{    int parent,lson,rson,visit,weight; }a[N]; int main() {          int t,n,m,count,i,j,max1,max2,total,sum; scanf("%d&quo…
Safe Or UnsafeTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3443    Accepted Submission(s): 1415 Problem DescriptionJavac++ 一天在看计算机的书籍的时候,看到了一个有趣的东西!每一串字符都可以被编码成一些数字来储存信息,但是不同的编码方式得到的储存空间是不一样的…
HDU 2527 :http://acm.hdu.edu.cn/showproblem.php?pid=2527 哈夫曼树,学完就忘得差不多了,题目的意思都没看懂,有时间复习下,看了别人的才知道是怎么回事. 贪心的题目,当总代价(要求最少)是由子代价累加或累乘出来,就可以考虑用哈夫曼来贪心. 题意: 就是给你一个字符串如:12 helloworld 统计出其中 d:1个,e:1个,h:1个,l:3个,o:2个,r:1个,w:1个,然后用一个数组保存起来a[7]={1,1,1,1,1,2,3};然…
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 1083 1084 1088 1106 1107 1113 1117 1119 1128 1129 1144 1148 1157 1161 1170 1172 1177 1197 1200 1201…
转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029.1032.1037.1040.1048.1056.1058.1061.1070.1076.1089.1090.1091.1092.1093.1094.1095.1096.1097.1098.1106.1108.1157…
模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 1049 1050 1057 1062 1063 1064 1070 1073 1075 1082 1083 1084 1088 1106 1107 1113 1117 1119 1128 1129 1144 1148 1157 1161 1170 1172 1177 1197 1200 1201 120…