随笔分类 -  kmp+博弈+二叉树

摘要:/*给你n个数,让你构建一个哈弗曼树,求哈弗曼编码的长度解:就是求除了叶子节点以外的所有节点的权值和*/#include#includeusing namespace std;typedef long long inta;struct node{ inta weight; bool operator... 阅读全文
posted @ 2014-10-03 19:01 HYDhyd 阅读(119) 评论(0) 推荐(0)
摘要:#includeint main() { int n,p,q,k; while(scanf("%d%d%d",&n,&p,&q)!=EOF) { k=n%(p+q); if(k<=p&&k!=0) printf("LOST\n"); else printf("WIN\n"); }... 阅读全文
posted @ 2014-05-08 21:33 HYDhyd 阅读(127) 评论(0) 推荐(0)
摘要:#include#includechars[11000],t[1100000];intnext[11000];voidgetkmp(intlen) {intj,k;next[0]=-1;j=0;k=-1;while(j<len) {if(k==-1||s[k]==s[j]) {j++;k++;if(... 阅读全文
posted @ 2014-04-08 16:14 HYDhyd 阅读(195) 评论(0) 推荐(0)
摘要:http://blog.163.com/qhx_405/blog/static/6338992620098140352928/ 阅读全文
posted @ 2014-03-30 19:20 HYDhyd 阅读(122) 评论(0) 推荐(0)
摘要:#include#include#define N 100#define INF 2000000000int b[N]; char s[100001];struct nodee{ int parent,lson,rson,visit,weight;}a[N];int main() { int ... 阅读全文
posted @ 2014-03-17 20:30 HYDhyd 阅读(300) 评论(0) 推荐(0)
摘要:http://blog.chinaunix.net/uid-26833883-id-3158234.html 阅读全文
posted @ 2014-03-17 19:20 HYDhyd 阅读(217) 评论(0) 推荐(0)
摘要:http://www.wutianqi.com/?p=1081 阅读全文
posted @ 2014-03-09 12:03 HYDhyd 阅读(121) 评论(0) 推荐(0)
摘要://http://www.cnblogs.com/bo-tao/archive/2012/04/16/2452633.html#include#includeint main() { int a,b,c; while(scanf("%d%d",&a,&b)!=EOF) { if(a<b) {... 阅读全文
posted @ 2014-03-09 12:00 HYDhyd 阅读(100) 评论(0) 推荐(0)
摘要:#include#define N 51000void getkmp(int next[],char s[]) { int j=0,k=-1; next[0]=-1; while(s[j]!=0) {if(k==-1||s[j]==s[k]) {j++;k++;if(s[j]!=s[k])next[... 阅读全文
posted @ 2014-03-08 14:03 HYDhyd 阅读(80) 评论(0) 推荐(0)
摘要:#include#include#define N 100100void getnext(int next[],char s[]) { int k=-1,j=0;next[0]=-1;while(s[j]!=0) {if(k==-1||s[j]==s[k]) {j++;k++;if(s[j]!=s... 阅读全文
posted @ 2014-03-07 21:35 HYDhyd 阅读(136) 评论(0) 推荐(0)
摘要:http://www.cppblog.com/oosky/archive/2006/07/06/9486.html#includeint a[10010],b[1000100],n,m,next[10010];void getnext() {int j=0,k=-1;next[0]=-1;while... 阅读全文
posted @ 2013-11-21 18:20 HYDhyd 阅读(97) 评论(0) 推荐(0)