为找规律题  结果为   节点数*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. wcf事务

    wcf服务 using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serial ...

  2. day3 进入指定目录:cd

    想进入指定目录使用cd cd 目录名 进入指定目录 进入系统根目录:cd / 回退命令:cd .. 或者 cd ../ 或者 cd ..// 进入当前用户的主目录:cd 或者 cd ~ 跳转指定目录: ...

  3. BSGS算法及其扩展

    bsgs算法: 我们在逆元里曾经讲到过如何用殴几里得求一个同余方程的整数解.而\(bsgs\)就是用来求一个指数同余方程的最小整数解的:也就是对于\(a^x\equiv b \mod p\) 我们可以 ...

  4. pygame(class类)调用视图的方法

    以下将介绍pygame精灵动画的基础知识,希望对大家有帮助:1.在此,精灵类必须继承pygame.sprite.Sprite并初始化pygame.sprite.Sprite.__init__(self ...

  5. ACM-ICPC 2018 徐州赛区网络预赛 G题

    题目链接: https://nanti.jisuanke.com/t/31459 具体思路: 先顺序输入,然后回溯,假设已经加入了n个点,那么在加入的同时,首先看一下原先x轴上已经有过的点,找到第一个 ...

  6. JS的call方法的作用解释,简单易懂

    先看看关于call()的官方解释,“调用一个对象的一个方法,以另一个对象替换当前对象.”,看了这样的解释,或许让你更摸不着头脑了.看例子: var x = "我是全局变量"; // ...

  7. commons-lang3-3.2.jar中的常用工具类的使用

    这个包中的很多工具类可以简化我们的操作,在这里简单的研究其中的几个工具类的使用. 1.StringUtils工具类 可以判断是否是空串,是否为null,默认值设置等操作: /** * StringUt ...

  8. 记一次Win Server 2012部署问题及解决方法

    1.前言 本章内容为在win server 2012服务器部署时遇到的问题及解决方法.大致工作为:两台服务器,一台web.一台数据库:web服务器部署.net web程序,数据库服务器安装oracle ...

  9. 【译】.NET Core 2.2 Preview 2 发布

    原文出自.Net Blog Announcing .NET Core 2.2 Preview 2 今天,我们宣布推出.NET Core 2.2 Preview 2.我们有很多重要改进要和你分享,而且我 ...

  10. java工程操作redis

    启动redis服务 redis-server redis.windows.conf 添加驱动 <dependency> <groupId>redis.clients</g ...