摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1710C:不要在for循环内定义变量,在函数开始处定义变量View Code #include<stdio.h>#include<string.h>#include<malloc.h>typedef struct tree{ int data ; struct tree *l, *r ;}tree, *tr ;int flag ;tr creat(int *root, int*in, int k){ tr t ; int *p ,m; if(k<=0) return 阅读全文
posted @ 2013-04-01 20:24 yelan@yelan 阅读(188) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1577View Code #include <stdio.h>#include <string.h>#include <malloc.h>typedef struct BiTree{ char ch; struct BiTree *lchild; struct BiTree *rchild;}BiTree;BiTree *createBiTree(char ch){ BiTree *leaf = (BiTree *)malloc(sizeof(BiTree)); leaf->ch = ch; lea 阅读全文
posted @ 2013-04-01 20:11 yelan@yelan 阅读(168) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1035View Code #include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct node{ char str[20]; int index;}ans[10010];struct Trie{ Trie *br[26]; int index; void init() { index=0; for(int i=0;i<26;++i) br[i]=NULL; ... 阅读全文
posted @ 2013-04-01 20:05 yelan@yelan 阅读(147) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2418View Code #include<stdio.h>#include<malloc.h>#include<string.h>char s[31] ;int sum = 0 ;struct BiTree{ int num ; char species[31] ; BiTree *l, *r ;} ;BiTree *t ;BiTree *creat(){ BiTree *p ; p = (struct BiTree*)malloc(sizeof(struct BiTree)) ; p->l = 阅读全文
posted @ 2013-04-01 19:55 yelan@yelan 阅读(239) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2001View Code #include<stdio.h>#include<string.h>#include<malloc.h>struct trie{ bool isstr ; int num ; trie *next[26] ;} ;void insert(trie *root, char *s){ int i ; if(root==NULL||*s=='\0') return ; trie *p = root ; while(*s) { if(p->next[*s... 阅读全文
posted @ 2013-04-01 19:34 yelan@yelan 阅读(154) 评论(0) 推荐(0) 编辑