为找规律题  结果为   节点数*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的更多相关文章

  1. Ancient Printer[HDU3460]

    Ancient Printer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)Tot ...

  2. Ancient Printer(tire树)

    Ancient Printer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/65536 K (Java/Others) ...

  3. hdu 3460 Ancient Printer

    Problem Description The contest is beginning! While preparing the contest, iSea wanted to print the ...

  4. Ancient Printer HDU - 3460 贪心+字典树

    The contest is beginning! While preparing the contest, iSea wanted to print the teams' names separat ...

  5. 【字母树+贪心】【HDU3460】【Ancient Printer】

    题目大意: 一个打印机 只有 打印,删除,a-z.操作 给你一堆队名,如何才能操作次数最少输出全部 (字典树节点数-1)*2 输入,删除操作数 字符串数 printf操作数 最长字符串的长度 最后一个 ...

  6. 【英语学习】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 ...

  7. 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 ...

  8. 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.

  9. 紫书例题-Ancient Cipher

    Ancient Roman empire had a strong government system with various departments, including a secret ser ...

随机推荐

  1. Java基础编程题——水仙花数

    package com.yangzl.basic; /** * 题目:打印出所有的"水仙花数". * 所谓"水仙花数"是指一个三位数, * 其各位数字立方和等于 ...

  2. MySQL - 日常操作一 增删改查

    mysql 源码安装 创建 mysql  账户 组 groupadd mysql useradd mysql -g mysql -M -s /bin/false 解压缩源码安装 .tar.gz cd ...

  3. JavaScript之判断参数的数值的详细类型

    //判断是否为字符串 //返回类型: //{baseType:typeof(arg),numberType:'int','float',-1} function numberType(arg){ va ...

  4. luogu P2502 [HAOI2006]旅行

    传送门 边数只有5000,可以考虑\(O(m^2)\)算法,即把所有边按边权升序排序,然后依次枚举每条边\(i\),从这条边开始依次加边,加到起点和终点在一个连通块为止.这个过程可以用并查集维护.那么 ...

  5. 关于Linux 虚拟机如何才能ping 通外网

    需要虚拟机能够联网.以前都是用桥接模式让虚拟机跟主机通信,这几天查了好多资料,都没有写得很详细,自己捣鼓了很久,把步骤写下来吧. 虚拟机操作步骤: 点击虚拟机的“菜单栏”上的“编辑”,再点击“虚拟网络 ...

  6. 解决:[DCC Fatal Error] **.dpk : E2202 Required package '***' not found

    //[DCC Fatal Error] **.dpk : E2202 Required package '***' not found 意思是:[DCC致命错误] *:e2202需包***没有发现 D ...

  7. Android NetworkInterface 的 name

    user@android:/$ ls /sys/class/net/ dummy0 lo p2p0 rev_rmnet0 rev_rmnet1 rev_rmnet2 rev_rmnet3 rmnet0 ...

  8. MySQL内连接、外连接、交叉连接

    外连接: 左连接:left join 或 left outer join 以左边的表为基准,如果左表有数据,而右表没有数据,左表的数据正常显示,右表数据显示为空. 创建user表,用于记录用户 use ...

  9. Dom4j用Xpath获取节点——(六)

    xml文档 <?xml version="1.0" encoding="utf-8"?> <书架> <书> <书名 n ...

  10. STM32F103X datasheet学习笔记---DMA

    1.前言 直接存储器存取(DMA)用来提供在外设和存储器之间或者存储器和存储器之间的高速数据传输. 无须CPU干预,数据可以通过DMA快速地移动,这就节省了CPU的资源来做其他操作. 两个DMA控制器 ...