E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Ancient
hdu 3460
Ancient
Printer trie字典树
#include usingnamespacestd; intans; structtrie { intnum; trie*next[26]; }; trie*rt=newtrie; voidsettrie(char*s) { trie*p=rt,*t; intn=strlen(s),i,c; if(n>p->num)p->num=n; for(i=0;inext[c]==NULL) { ans
xinag578
·
2015-10-08 07:00
UVALive - 3213
Ancient
Cipher
题目链接: UVALive-3213AncientCipher 给出两个字符串,希望你建立一个字母的映射关系,将第一个字符串映射成第二个字符串,要求不同字符映射到不同字符。 解法是统计每个字符出现的次数,后将次数进行排序,如果出现次数排序后的结果相同,就必定存在符合要求的映射。#include #include #include #include #include usingnamespa
sinat_29278271
·
2015-09-19 23:00
大白上的题目
POJ 2159
Ancient
Cipher(水~)
Description该题的关键就是只要知道原来信息和加密后的信息中字母的频数相同则为YESInput两个字符串分别表示原来信息和加密后的信息Output若两信息中个字母频数相同则输出YES,否则输出NOSampleInputJWPUDJSTVPVICTORIOUSSampleOutputYESSolution简单字符串处理,统计两串中个字母的频数,分别排完序后一一比较,全部相同则YES,否则NO
V5ZSQ
·
2015-08-27 08:00
HDU - 3460
Ancient
Printer(字典树)
HDU-3460AncientPrinterTimeLimit: 1000MS MemoryLimit: 65536KB 64bitIOFormat: %I64d&%I64uSubmit StatusDescriptionThecontestisbeginning!Whilepreparingthecontest,iSeawantedtoprinttheteams'namesseparatelyo
qq_18661257
·
2015-08-09 11:00
CodeForces 1C -
Ancient
Berland Circus
这道也太数学了吧!#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include usingnamespacestd; constintMA
MrSiz
·
2015-08-05 11:00
算法
CF
UVa1339
Ancient
Cipher
#include <iostream>#include <string>#include <cstring> // for memset#include <algorithm>using namespace std;int main(){ int ce[26], co[26];
·
2015-06-27 13:00
uva
Distribution(F题)---第八届河南省程序设计大赛
Description One day , Wang and Dong in the Dubai desert expedition, discovered an
ancient
castle.
·
2015-05-16 21:00
程序设计
【字母树+贪心】【HDU3460】【
Ancient
Printer】
题目大意:一个打印机只有打印,删除,a-z。操作给你一堆队名,如何才能操作次数最少输出全部(字典树节点数-1)*2输入,删除操作数字符串数printf操作数 最长字符串的长度最后一个不需要删除,所以尽量找最大的所以answer=(字典树节点数-1)*2+字符串数-最长字符串的长度 #include #include #include #include #include #include #inc
zy691357966
·
2015-05-09 14:00
HDU 3460
Ancient
Printer
ProblemDescriptionThecontestisbeginning!Whilepreparingthecontest,iSeawantedtoprinttheteams'namesseparatelyonasinglepaper.Unfortunately,whatiSeacouldfindwasonlyanancientprinter:soancientthatyoucan'tbel
jtjy568805874
·
2015-04-22 17:00
HDU
字典树
POJ2159
Ancient
Cipher【字符密码】
题目链接:http://poj.org/problem?id=2159题目大意:古罗马帝王的保密服务部门的保密方法是替换和重新排列。替换方法是将出现的字符替换成其他的字符。如将'A'替换成'Z',将'Z'替换成'A'。排列方法是改变原来单词中字母的顺序。例如将顺序变为。应用到字符串"VICTORIOUS"上,则可以得到"IVOTCIRSUO"。单用一种解密方法是不安全的,只有将两种方法结合起来才安
u011676797
·
2015-03-28 10:00
UVA 1339 -
Ancient
Cipherguo(水题)
题意:给定2个字符串,判断做一个映射后能否一一对应。思路:把每个字母个数保存下来,排序,看能否一一对应即可。AC代码#include #include #include #include #include usingnamespacestd; typedeflonglongll; constintN=105; charstr1[N],str2[N]; intnum1[30],num2[30]; i
HelloWorld10086
·
2015-02-26 16:00
uva
1339
uva 1339
Ancient
Cipher(字符串处理)
题目大意:给出两个字符串,判断两个字符串中的字符是否一一对应,一一对应指的是字符串中某个字符的个数与另一个字符串中某一个字符的个数相同(字符不可以重复考虑)解题思路:开个数组统计字符的个数,用sort函数排序后比较。#include #include intmain(){ charA[110],B[110]; while(scanf("%s%s",A,B)!=EOF){ intlen_1=str
kl28978113
·
2015-02-19 23:00
Uva 1339 -
Ancient
Cipher
题目不难,但是思路方面还是很巧妙,要注意一点,本题字母之间的映射关系并不一定是一样的,例如若B对应A,那也不表明C就对应B,还有一点,写代码时因为粗心,写了两遍memset(na,0,sizeof(na));而丢了memset(nb,0,sizeof(nb));导致输出一直有问题,看了好久才发现的,这种低级错误以后要尽量避免。#include #include #include intmain()
ft_sunshine
·
2015-02-14 18:00
hdu 3460
Ancient
Printer (字典树)
题意:给出n个单词,现在模拟键盘输入,输入字母和删除以及发送都要算操作数。现在给出的n个单词不管顺序如何,将所有单词输出的最小操作数。题解:没想可以这样做,我们把这些单词存入字典树,然后把字典树画出来,很容易得出这个结论:假设字典树节点的个数为m,最长单词长度为maxl,那么最小操作数=2*m-maxl+n#include #include #include #include #include #
My_ACM_Dream
·
2015-02-06 19:00
uva_1339_
Ancient
Cipher
解题过程:刚开始读了一遍英文的题目,没大怎么看明白,算input怎么也解不出来output,以为是不同字母和对应的映射字母之间的差值必须为固定的(没翻译出来原题中“Substitutioncipherchangesalloccurrencesofeachlettertosomeotherletter.Substitutesforalllettersmustbedifferent.Forsomele
a7055117a
·
2015-02-05 22:00
c
uva
古老的密码(
Ancient
Cipher)
AncientCipherTimelimit:3.000secondsAncientRomanempirehadastronggovernmentsystemwithvariousdepartments,includingasecretservicedepartment.Importantdocumentsweresentbetweenprovincesandthecapitalinencrypt
qq_15096707
·
2015-02-03 15:00
java
String
uva
cipher
古老的密码
Ancient
UVa 1103 -
Ancient
Messages(DFS:Floodfill)
给出六种象形文字。然后给出十六进制的数表,求对应数表的01图所含有的字母,获得字母按字典序打印。书上给了很巧妙的思路:每个字母中白色块的数目不同,依此判断字母是什么。先把数表转化为二进制。然后进行一次Floodfill把所有的象形文字独立出来。要注意先加一圈“空气”使得无关的0连通。然后对每个独立的象形文字进行Floodfill,求有几个白色连通块。查找出对应的字母。该字母数量+1。最后按字典序输
wcr1996
·
2015-01-28 20:00
uva
例题4-1 uva
Ancient
Cipher
书上例题。。。主要是学习下sort的用法之前用的都是qsort#include #include #include usingnamespacestd; chara[104],b[104]; intcnt1[26],cnt2[26]; intmain() { while(scanf("%s%s",a,b)==2) { memset(cnt1,0,sizeof(cnt1)); memset(cnt2
liujc_
·
2015-01-26 23:00
codeforces--
Ancient
Berland Circus(三点确定最小多边形)
AncientBerlandCircusTimeLimit:2000MS MemoryLimit:65536KB 64bitIOFormat:%I64d&%I64uSubmit StatusAppointdescription: SystemCrawler (2015-01-06)DescriptionNowadaysallcircusesinBerlandhavearoundar
u013015642
·
2015-01-08 21:00
uvaoj1339
ancient
cipher
/*AncientRomanempirehadastronggovernmentsystemwithvariousdepartments,includingasecretservicedepartment.Importantdocumentsweresentbetweenprovincesandthecapitalinencryptedformtopreventeavesdropping.Them
kalilili
·
2014-12-03 22:00
Ancient
Berland Circus
这道题不会,看了网上思路是,先求边,然后通过海伦公式得到外接圆半径,得到三个圆心角,然后求最大公约数gcd,那么边数就是2pi/gcd,然后求出最小单位的三角形面积,乘上边数就是答案。几何题果然不行
Guard_Mine
·
2014-10-27 09:00
codeforces
UVa 1339 -
Ancient
Cipher
例题,但书上没代码,就发上来了。前几天理解错题意了,以为是像凯撒密码一样固定位移映射,后来才发现只是个普通的单表替换。书上让用qsort,这几天学了点c++,就直接用sort了。#include #include #include #definemaxn110 usingnamespacestd; intmain() { inti,j,n,k; intcnt1[26],cnt2[26]; char
wcr1996
·
2014-10-22 16:00
UVA1339-
Ancient
Cipher
题意:给定两个长度均为n的字符串,判断它们之间的26个字母能否一一对应,即做一个一一映射后使得两个字符串相同。输入两个字符串,输出YES或者NO。思路:只要判断出现的字母的次数能否完全一一对应即可,比如s1存在出现3次的字符,那么s2中也必须存在这样的字符。#include #include #include #include usingnamespacestd; constintMAXN=1
u011345461
·
2014-08-08 09:00
Uva1339 -
Ancient
Cipher
#include #include #include #include chars[105],s2[105]; intt[26],t2[26]; voidmycount(intt[],chars[],charalp[]){//标记是s[]中各字母出现次数 for(inti=0;i
sinat_17231979
·
2014-08-02 21:00
HDU 1542 Atlantis
题目意思:就是说一个平面上有很多个矩形,求他们在平面上的覆盖面积 Problem Description There are several
ancient
Greek texts that contain
·
2014-07-29 10:00
ant
1103 -
Ancient
Messages【后台数据】
#include #include #include #include #include #include #include #defineMAXD500+10 usingnamespacestd; intm,n,t; charMap[MAXD+10][400+10]; intvis[MAXD+10][400+10]; charbiao[20][10]; constintdir[4][2]={{-
u013451221
·
2014-07-27 20:00
Atlantis(线段树 + 扫描线 + 离散化)
Total Submissions: 16991 Accepted: 6479 Description There are several
ancient
Simone_chou
·
2014-07-25 23:00
ant
CodeForces 1C
Ancient
Berland Circus
题目链接: http://codeforces.com/problemset/problem/1/C题意:题目巴拉巴拉说了一通,其实就是给出一个正n边形上的三个点,要你求出这个正n边形的面积,需要n最小题解:首先可以明确的是:用着三个点可以确定这个正多边形的外接圆所有可以先求出这个三点所构成的三角形的边长a,b,c,利用海伦公式求出三角形面积S然后利用R=abc/(4S),求出这个外接圆的半径
fjy4328286
·
2014-07-22 10:00
codeforces
计算几何
UVA 1339 -
Ancient
Cipher
就是刘汝佳书上所说的思路……没想太多,但是没有用他讲的方法,用了更简单的sort排序#include #include #include usingnamespacestd; constintmaxn=120; chars1[maxn],s2[maxn]; intc1[26]; intc2[26]; intmain() { while(scanf("%s",s1)!=EOF) { scanf("%
u013382399
·
2014-07-20 02:00
uva
Ancient
Berland Circus
果然Java还是不靠谱啊,一个NaN把我整了半天~~题目大意:有一个正多边形,给出任意三个顶点的坐标,求这个正多边形的最小面积。解题思路:首先要知道这三个顶点组成的三角形的外接圆一定是这个正多边形的外接圆。用过计算出三角形的三边长,可以计算出三角型面积,进而推出外接圆半径。可以得到三个圆心角,找出最大公约数,那就是最大角度。就可以计算出多边形面积了~~下面是代码:importjava.text.D
lin375691011
·
2014-05-27 20:00
codeforces
计算几何
刷题
POJ2159:
Ancient
Cipher
总时间限制:1000ms 内存限制:65536kB描述AncientRomanempirehadastronggovernmentsystemwithvariousdepartments,includingasecretservicedepartment.Importantdocumentsweresentbetweenprovincesandthecapitalinencryptedfo
cdj0311
·
2014-05-16 16:00
算法
ACM
stm32f10x_conf.h 与 stm32f10x.h
http://hi.baidu.com/
ancient
2008/blog/item/ea0ea30d4aa59cd53bc7638c.html新版的固件库V3.0以上main等源文件中不再直接包含stm32f10x_conf.h
ysmz4
·
2014-05-07 15:00
stm32
CodeForces-1C-
Ancient
Berland Circus
NowadaysallcircusesinBerlandhavearoundarenawithdiameter13meters,butinthepastthingsweredifferent.InAncientBerlandarenasincircuseswereshapedasaregular(equiangular)polygon,thesizeandthenumberofanglescoul
u012861385
·
2014-04-21 22:00
HDOJ 4276 The Ghost Blows Light(树形DP)
Problem Description My name is Hu Bayi, robing an
ancient
tomb in Tibet.
·
2014-03-16 18:00
host
UVa:1339
Ancient
Cipher
确实没有想到这个题的思路,我还尝试用搜索来做。这俩种加密方式都是1对1的,所以不会改变某个字母出现的次数。这样只要统计明文和密文中字母出现次数是否都一致即可。 #include #include #include #include #include #include #include #include #include #include #defineMAXN105 #def
kkkwjx
·
2014-01-21 16:00
批处理之播放文本文件
mshta vbscript:createobject("sapi.spvoice").speak("There is a piece of pure land of legend, lived in
ancient
moki_oschina
·
2013-12-21 16:00
C++
文本
语音
调用
批处理
播放
UVA 1339 -
Ancient
Cipherguo
AncientRomanempirehadastronggovernmentsystemwithvariousdepartments,includingasecretservicedepartment.Importantdocumentsweresentbetweenprovincesandthecapitalinencryptedformtopreventeavesdropping.Themos
u011217342
·
2013-12-13 12:00
Uva1339
Ancient
Cipher
题目链接:Uva1339AncientCipher水题一道,题目描述很复杂,其实只要统计句子中的单词数目是不是对应相等就好了。 importjava.util.*; publicclassMain{ /** *@paramargs */ publicstaticvoidmain(String[]args){ //TODOAuto-generatedmethodstub Scannerin=new
tonghu2010
·
2013-12-01 23:00
(Relax ST1.11)POJ 2159
Ancient
Cipher(判断一个字符串是否是另外一个字符串的原串)
本文分析部分转载自http://blog.csdn.net/lyy289065406/article/details/6642586PS:本题稍微说一下题意(当时有点发牢骚的感觉,O(∩_∩)O哈哈~)一种我认为是比较符合现实的解题思路,但是总是WrongAnswer 咋看之下确实是被题目忽悠了,一般思路都是先对置换解密,再对乱序解密,但是题目所给出的乱序码只有10个,,输入要求却是不大于100的
caihongshijie6
·
2013-11-30 13:00
杭电1010Tempter of the Bone
Tempter of the Bone Problem Description The doggie found a bone in an
ancient
maze, which fascinated
·
2013-11-28 21:00
one
Ancient
Berland Circus
对于一个边数未知的正多边形,给出其上的三个点,求出其可能的最小的面积。首先对于正多边形其中心肯定是给出三角形的外形。然后对于三角形的三个角求最大公约数A。则N=2*Pi/A。剩下的就是计算面积了。做题的时候一直在纠结怎样求边数,然后发现double类型的也能求出最大公约数来。。。#include #include #include #include #include #include #inclu
u012161037
·
2013-11-25 20:00
hdu 3839
Ancient
Messages (dfs )
题目大意:给出一幅画,找出里面的象形文字。要你翻译这幅画,把象形文字按字典序输出。思路:象形文字有一些特点,分别有0个圈、1个圈、2个圈...5个圈。然后dfs或者bfs,就像油井问题一样,找出在同一块的0,找出在同一块的1,分别标上记号。对于每个同一块的1,如果它们只和1个‘0’的块相邻,就表明这个象形文字没有圈。如果和2个‘1’的块相邻,就说明这个象形文字有一个圈。依此类推...和6个‘1’块
csuhoward
·
2013-11-20 15:00
北大ACM 2159
Ancient
Cipher——这题一点都不水!!!!
AncientCipherTimeLimit: 1000MS MemoryLimit: 65536KTotalSubmissions: 26102 Accepted: 8592DescriptionAncientRomanempirehadastronggovernmentsystemwithvariousdepartments,includingasecretservicedepartment.
q745401990
·
2013-11-10 16:00
poj 2159
Ancient
Cipher
这题主要应该就是理解题意的问题,我的确是把题目理解错了,WA了三次,每次都以为一定是正确的,后来看了别人的解释才知道是题目理解错了(竟然还看到了别人的结题报告也有错的。。。),另外就是学会了用STL的sort快排,很方便,在头文件里面,这说明了一定要自己会写排序,但是不一定每次都是自己写函数,有N多好的函数别人已经写好了,你只用知道什么时候该用就可以了。。。但是自己也要会写(万一比赛不允许用库函数
Scythe666
·
2013-10-05 16:00
编程之道--Book Two - The
Ancient
Masters
摘自《编程之道》将此书献给那些爱笑也爱思考的程序设计者,以及那些同程序设计者打交道的管理人员,当然他们也爱笑爱思考。 编程之道--BookTwo-TheAncientMastersThusspakethemasterprogrammer:编程大师如是说:"Afterthreedayswithoutprogramming,lifebecomesmeaningless."三日不编程,食肉无味。2.1T
hitwhylz
·
2013-10-01 18:00
CF1C
Ancient
Berland Circus
对于这种水题,我只想说:为啥精度只有开1e-3才能过==(计算几何水题,大家就不要看了==)#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include u
huangshenno1
·
2013-09-24 00:00
NEERC 2004 / UVa 1339
Ancient
Cipher (模拟)
1339-AncientCipherTimelimit:3.000secondshttp://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=457&page=show_problem&problem=4085AncientRomanempirehadastronggovernmentsystemwith
synapse7
·
2013-09-01 23:00
C++
ACM
uva
poj - 2159 -
Ancient
Cipher(统计)
题意:输入两个等长度的字符串(每一个字符串的长度不超过100),问第一个字符串能否由第二个字符串经过字母变换和字母移位得到,以的话输出"YES",否则输出"NO"。题目链接:http://poj.org/problem?id=2159——>>曾经在Uva上做过和这道差不多的题目,思路也是一样的,很常用思路:统计字母出现的个数。1、两个字符串分别统计字母出现的次数;2、分别对次数进行排序;3、排序后
SCNU_Jiechao
·
2013-08-31 23:00
Ancient
decoration(最小环覆盖)
给你一个n个点,每个点度为k(k为偶数)的无向图,问是否能将图中的n条边染色,使得每个点都拥有两条被染色的边。也就是说,是否存在拥有原图中n条边的子图,使得每个点的度为2?仔细想想,每个点的度为2,实际上就是求原图的最小环覆盖了。求最小环覆盖的方法就是先求出原图的有向欧拉回路(k为偶数,欧拉回路必然存在),然后问题就转化成了是否能选择欧拉回路中的n条边,使得所有点都被覆盖?这不就转化成了DAG的最
diary_yang
·
2013-08-30 16:00
HDU 3460
Ancient
Printer
ProblemDescriptionThecontestisbeginning!Whilepreparingthecontest,iSeawantedtoprinttheteams'namesseparatelyonasinglepaper.Unfortunately,whatiSeacouldfindwasonlyanancientprinter:soancientthatyoucan'tbel
HRHACMER
·
2013-08-25 15:00
上一页
1
2
3
4
5
6
7
8
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他