Ancient Printer
为找规律题 结果为 节点数*2-最长字段+字段个数
结点不能设置为0 与判断条件相冲突
#include<bits/stdc++.h>
using namespace std; int trie[][]={};
int sum[];
char ans[][];//这里数组开小了导致一直wa
int root=;
int pos;
void insert1(char *s)
{
int root=;
for(int i=;i<strlen(s);i++)
{ int ch=s[i]-'a';
if( trie[ root ][ch]== )
{
memset(trie[pos],,sizeof(trie[pos]));//用多少初始化多少
trie[root][ch]=pos++; }
root=trie[root][ch];
} } int main()
{ int n;
while(scanf("%d",&n)==)
{
pos=;
memset(trie[],,sizeof(trie[]));//用多少初始化多少
int maxx=;
for(int i=;i<=n;i++)
{ char a[];
scanf("%s",a);
maxx=maxx>strlen(a)?maxx:strlen(a);
insert1(a); }
printf("%d\n",(pos-)*-maxx+n); } return ;
}
Ancient Printer的更多相关文章
- Ancient Printer[HDU3460]
Ancient Printer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Tot ...
- Ancient Printer(tire树)
Ancient Printer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) ...
- hdu 3460 Ancient Printer
Problem Description The contest is beginning! While preparing the contest, iSea wanted to print the ...
- Ancient Printer HDU - 3460 贪心+字典树
The contest is beginning! While preparing the contest, iSea wanted to print the teams' names separat ...
- 【字母树+贪心】【HDU3460】【Ancient Printer】
题目大意: 一个打印机 只有 打印,删除,a-z.操作 给你一堆队名,如何才能操作次数最少输出全部 (字典树节点数-1)*2 输入,删除操作数 字符串数 printf操作数 最长字符串的长度 最后一个 ...
- 【英语学习】2016.09.11 Culture Insider: Teacher's Day in ancient China
Culture Insider: Teacher's Day in ancient China 2016-09-10 CHINADAILY Today is the 32nd Chinese Te ...
- Good Bye 2015 D. New Year and Ancient Prophecy
D. New Year and Ancient Prophecy time limit per test 2.5 seconds memory limit per test 512 megabytes ...
- When you install printer in Ubuntu, just need a ppd file.
Search printing in the system and add printer. Then import ppd file. That is all.
- 紫书例题-Ancient Cipher
Ancient Roman empire had a strong government system with various departments, including a secret ser ...
随机推荐
- spring注解第06课 @Value
1.注入<bean>中的属性 支持3种类型的赋值 <bean id="person" class="com.model.Person"> ...
- pycharm永久激活(转)
机器上安装的pycharm失效了,注册服务器也不管用了.网上找了一个比较满意的激活方法,推荐给大家: 第一步:下载jar包: 此jar包的目的就是让截获截止时间并骗过pycharm; 百度云下载地址 ...
- Flask最强攻略 - 跟DragonFire学Flask - 第四篇 Flask 中的模板语言 Jinja2 及 render_template 的深度用法
是时候开始写个前端了,Flask中默认的模板语言是Jinja2 现在我们来一步一步的学习一下 Jinja2 捎带手把 render_template 中留下的疑问解决一下 首先我们要在后端定义几个字符 ...
- JXL导出Excel(只支持xls版本)——(一)
注意: 导出的后缀是xls可以直接打开,如果导出的后缀是xlsx打开报错,需要手动将名字改为xls才可以打开.也就是JXL不可以导出xlsx的excel. Jar包
- 基于Python的机器学习实战:AadBoost
目录: 1. Boosting方法的简介 2. AdaBoost算法 3.基于单层决策树构建弱分类器 4.完整的AdaBoost的算法实现 5.总结 1. Boosting方法的简介 返回目录 Boo ...
- caffe-win10-cifar10另
上一篇主要以bat形式实现了leveldb形式的cifar10,因为对于shell脚本不甚熟悉,所以这次专门利用.sh调用来实现lmdb形式的cifar10. 1.下载数据 同上一篇. 2.数据转换和 ...
- linux kernel的cmdline参数解析原理分析【转】
转自:https://blog.csdn.net/skyflying2012/article/details/41142801 版权声明:本文为博主kerneler辛苦原创,未经允许不得转载. htt ...
- OCM_第二十天课程:Section9 —》Data Guard _ DATA GUARD 搭建/DATA GUARD 管理
注:本文为原著(其内容来自 腾科教育培训课堂).阅读本文注意事项如下: 1:所有文章的转载请标注本文出处. 2:本文非本人不得用于商业用途.违者将承当相应法律责任. 3:该系列文章目录列表: 一:&l ...
- js继承的几种实现方法
一.用function实现: function Person(name) { this.name = name; } Person.prototype.getName = function() { r ...
- CNN中各种各样的卷积
https://zhuanlan.zhihu.com/p/29367273 https://zhuanlan.zhihu.com/p/28749411 以及1*1卷积核:https://www.zhi ...