字典树:动物统计加强版 (nyoj)
来源:互联网 发布:机场 知乎 编辑:程序博客网 时间:2024/06/05 05:34
#include<bits/stdc++.h>using namespace std;struct node{ struct node *next[26]; int cot;} a[1000000];node *now=a;int insert(node * &root,char *str){ if(!root) root=now++; node *p=root; while(*str) { //printf("sssss"); int i=*str-'a'; if(!p->next[i]) p->next[i]=now++; p=p->next[i]; str++; } p->cot++; return p->cot;}int main(){memset(a, 0, sizeof(node) * 1000000); int n; scanf("%d",&n); char str[11]; char t[11]; int ans=0; node *root; root=NULL; while(n--) { scanf("%s",str); int temp=insert(root,str); if(temp>ans) { strcpy(t,str); ans=temp; } } printf("%s %d\n",t,ans); return 0;}
0 0
- NYOJ 题目290 动物统计加强版(字典树)
- NYOJ 题目290 动物统计加强版(字典树)
- 字典树:动物统计加强版 (nyoj)
- NYOJ 动物统计加强版(字典树经典例子)
- NYOJ 290 动物统计加强版(字典树)
- nyoj 290 动物统计加强版 字典树
- NYOJ--290--动物统计加强版(字典树简单运用)
- NYOJ 290 动物统计加强版 (字典树)
- nyoj 290 动物统计加强版 <字典树>
- NYOJ 290 动物统计加强版 (字典树)
- 动物统计加强版(字典树)
- nyoj 动物统计加强版 290 (字典树) 好题
- NYOJ 290 动物统计加强版(字典树模板题)
- nyist 290 动物统计加强版(字典树)
- nyoj290动物统计加强版(字典树)
- NYOJ 290动物统计加强版(Trie树)
- nyoj 290 动物统计加强版(RS哈希)
- 南阳oj 题目290 动物统计加强版 字典树
- quartz入门(二)SimpleTrigger简单实例
- github 上 Fork 别人的项目后的常用的操作指南
- Red Hat Enterprise Linux 7(RHEL7)安装oracle11gr
- 编译speex过程
- hdu1134 Game of Connections(卡特兰数)
- 字典树:动物统计加强版 (nyoj)
- 05.ZooKeeper读书笔记之开源客户端(Curator)
- 最流行的android组件大全
- HTML CSS JS(一)
- MyEclipse移动Web模拟器指南(一)
- java线程同步-synchronized
- cocos获取当前时间
- iOS开发笔记--公司开发者账号申请详细教程
- (三)SDN 控制器 NOX 源码分析之—— Event_dispatcher