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 ...
随机推荐
- ubuntu18虚拟机克隆之后ip相同的解决方案
最近使用虚拟机装ubuntu18.04,克隆后发现ip是相同的,应为克隆采用的是文件克隆,所以所有的东西都一样.解决最简单的方法就是修改mac然后启动使用netplan apply命令,重启reboo ...
- modbus-vcr介绍
相关链接:modbus-vcr modbus-vcr是一个Ettercap的插件,被使用在缺少数据完整性的工业控制系统协议方面. 这个Ettercap插件执行一个MITM攻击在使用Modbus协议的系 ...
- TwemProxy Redis架构
TwemProxy 1.twemproxy是twitter开发的一个redis代理proxy. 通过Twemproxy可以使用多台服务器来水平扩张redis服务,可以有效的避免redis单点故障问题. ...
- 下拉选择框QCombox
下拉列表框样式如图: 字体列表框样式: import sys from PyQt5.QtWidgets import QApplication, QWidget, QComboBox, QFontCo ...
- A - Longest k-Good Segment (尺取法)
题目链接: https://cn.vjudge.net/contest/249801#problem/A 解题思路:尺取法,每次让尺子中包含k种不同的数,然后求最大. 代码: #include< ...
- Mybatis进阶学习笔记——输出映射
输出映射(例如一个方法的返回至使用什么类型去接收) 1.基本类型 <!-- 统计记录数 --> <select id="queryTotalCount" resu ...
- javascript中cookie常用操作
//写cookies function setCookie(c_name, value, expiredays){ var exdate=new Date(); exdate.setTime(exda ...
- angular下载安装
1.下载安装nodejs 官方地址:https://nodejs.org/en/download/ 2.验证是否安装成功 node -v npm -v 公司内网需要设置代理 npm confi ...
- PHP框架CodeIgniter--URL去除index.php
今天学习CodeIgniter简称CI的第一天,记录下学习心得. CI中国https://codeigniter.org.cn/user_guide/general/urls.html?highlig ...
- Springboot分模块开发
这是个spring cloud项目,service-base:基础服务:service-config:配置中心:service-entity:实体类: service-gateway:服务网关:ser ...