rqnoj-429词链-字典树
来源:互联网 发布:淘宝和天猫的区别 编辑:程序博客网 时间:2024/06/13 09:27
不晓得字典树的问题怎么跑到动态规划上了。。。
裸字典树,传递当前字典路上的数量
#include<stdio.h>#include<string.h>#include<algorithm>#include<iostream>#define maxn 51*10000using namespace std;struct list{ int id; int num; struct list *next[27];}*root;int maxx;struct list *creat(){ int i; struct list *p; p=new list; p->id=0; p->num=0; for(i=0;i<27;i++) { p->next[i]=0; } return p;}void dos(char str[]){ int mn; mn=0; struct list *p; p=root; int n,j; n=strlen(str); for(j=0;j<n;j++) { int c=str[j]-'a'; if(p->next[c]==NULL) { p->next[c]=creat(); } p=p->next[c]; mn=max(mn,p->num); } p->num=mn+1; maxx=max(maxx,mn+1);}int main(){ int n,i; char str[101]; while(~scanf("%d",&n)) { maxx=0; root=creat(); for(i=0;i<n;i++) { scanf("%s",str); dos(str); } cout<<maxx<<endl; }}
- rqnoj-429词链-字典树
- rqnoj-429词链
- RQNOJ 429 词链
- 【其他】【RQNOJ】二叉树计数
- 【其他】【RQNOJ】单词查找树
- RQNOJ LIS专题 201奥运大包围,569Milking Time,429词链
- 校门外的树-rqnoj-13
- RQNOJ 49 加分二叉树 (树形DP)
- RQNOJ PID322——单词查找树
- rqnoj-332 & rqnoj-53
- 字典树
- 字典树
- 字典树
- 字典树
- 字典树
- 字典树。。
- 字典树
- 字典树
- Oracle ROWID
- zoj 3683 模拟
- chapter 8 Compilation, Execution, and Errors
- HTML5实现音频播放
- HBase入门篇4–存储
- rqnoj-429词链-字典树
- 检测当前URL是否可连接或是否有效
- 获取AIX文件最后修改时间,类似Linux的time-style显示的时间格式
- autotools使用说明
- 程序员:孤独的人是可耻的!
- GDI编程小结
- 用Libzbar自带打开闪光灯功能 不需要再去网上找了
- <supports-screens> 让你的layout适应屏幕的大小包括 平板
- 容器类常用方法(3)