摘要: 这道又是submission error ,先存下档。 1 #include 2 #include 3 const int maxnode=4000*1000+10; 4 int ch[maxnode][62]; 5 int val[62]; 6 int sz; 7 int index(char ch) 8 { 9 if(ch>='0'&&ch'A'&&ch1) ans+=val[i];49 ans+=((n-1)*n)/2;50 printf("Case %d: %d\n",kcase++,ans);5 阅读全文
posted @ 2013-08-26 20:38 sooflow 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 递推式:d[i]=sum(d[i+len[x]])这道题的数据真狗血,改了一点就过了。 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxnode=4000*100+10; 6 const int mod=20071027; 7 const int maxn=300000 + 10; 8 const int maxw=4000 + 10; 9 char ss[maxn];10 char s[110];11 int d[maxn];12 int len[maxw];13 int ch[maxnode][2 阅读全文
posted @ 2013-08-26 19:51 sooflow 阅读(262) 评论(0) 推荐(0) 编辑
摘要: 因为查询的前缀字典可能不含有,这点没考虑清楚就码了,太粗心了,因为case只有一个,很多初始化操作都不需要了。 1 #include 2 #include 3 const int maxnode=500000; 4 int ch[maxnode][26]; 5 int val[maxnode]; 6 int sz; 7 void insert(char *s) 8 { 9 int u=0,len=strlen(s);10 for(int i=0;i<len;i++)11 {12 int c=s[i]-'a';13 if(!ch[u][c]... 阅读全文
posted @ 2013-08-26 14:38 sooflow 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 只能说数据比较水而已结点应该得开到le10的,刚开始那么开的时候,编译出错了,说是数组开太大了,后来改成le6就过了。 1 #include 2 #include 3 const int maxnode=1e4; 4 int ch[maxnode][10]; 5 int val[maxnode]; 6 int sz; 7 void insert(char *s) 8 { 9 int u=0,n=strlen(s);10 for(int i=0;i=2) return 0;29 return 1;30 }31 int main()32 {33 int t;34 ... 阅读全文
posted @ 2013-08-26 13:20 sooflow 阅读(164) 评论(0) 推荐(0) 编辑