Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

关键:只要频率分布一样,就是YES!!!!

Posted by victor0127 at 2011-10-19 22:27:58 on Problem 2159
这道题如果没看懂题意,绝对不是水题,能愁死你,而如果看懂了的话,的确稍微有点小水。
关键是对代替加密和置换加密的理解,题目中给出的例子容易误导你进入误区: 代替加密是按照一定规律来的。所以你会很容易的想到先排序,找两个字符串的差距,如果一样就YES了。。
其实,代替加密没有“规律”!A可以对应任意的26个字母。
不知道说明白了没有

所以 是否相同的标准就是  1 两个字符串初始长度是否相同  2. 频率分布是否相同(不管哪个字母的频率,只要频率从小到大排列出来,两个字符串完全相同就可以)

举个例子:
abbccc
mqqbbb
YES 频率都是 1 2 3

aabbcc
mnnjjj
NO 频率分别为 2 2 2和 1 2 3

好了,大体上就这样。


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator