一百题留念,继续加油 Read More
posted @ 2011-12-03 18:53 Because Of You Views(300) Comments(0) Diggs(0) Edit
View Code class trie{public: int num; trie *child[26]; trie() { num=0; memset(child,0,sizeof(child)); }}root;int insert(char *s){ class trie *cur=&root; int len=strlen(s); for(int i=0;i<len;i++) { int id=s[i]-'a'; if(!cur->child[id]) ... Read More
posted @ 2011-12-03 18:42 Because Of You Views(323) Comments(0) Diggs(0) Edit
提交了很多次,不想多说了第一种方法非常暴力View Code #include<stdio.h>#include<string.h>#include<algorithm>#include<iostream>using namespace std;int num,tot;int cnt[2011];int map[2011][2011];char dic[2011][20];struct node{ char s[20];}ans[2011];bool cmp(node a,node b){ return strcmp(a.s,b.s)<0; Read More
posted @ 2011-12-03 18:34 Because Of You Views(369) Comments(0) Diggs(0) Edit