题目写一个函数对字符串数组排序,使得所有的变位词都相邻。解答首先,要弄清楚什么是变位词。变位词就是组成的字母相同,但顺序不一样的单词。 比如说:live和evil就是一对变位词。OK,那么这道题目的意思就很清楚了, 它并不要求我们将字符串数组中的字符串按字典序排序,否则我们直接调用STL中的sort...
分类:
编程语言 时间:
2015-04-22 23:38:16
阅读次数:
164
RAONE - Ra-One Numbers
no tags
In the War between good and evil . Ra-One is on the evil side and G-One on the good side.
Ra-One is fond of destroying cities and its G-one's duty to prote...
分类:
其他好文 时间:
2015-04-19 10:14:09
阅读次数:
166
13460. Passwords
Constraints
Time Limit: 1 secs, Memory Limit: 256 MB
Description
Mirko is an evil plotting genius and has gotten hold of a list of all possible passwords for a certa...
分类:
其他好文 时间:
2015-04-13 23:03:03
阅读次数:
241
float Q_rsqrt( float number ){ long i; float x2, y; const float threehalfs = 1.5F; x2 = number * 0.5F; y = number; i = * ( long * ) &y; // evil ...
分类:
其他好文 时间:
2015-04-12 11:51:56
阅读次数:
239
H - Can you answer these queries?
Time Limit:2000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64u
Submit Status Practice HDU 4027
Description
A lot of battleships of evil are arranged in a ...
分类:
其他好文 时间:
2015-04-07 09:57:12
阅读次数:
169
UVA - 10716
Evil Straw Warts Live
Time Limit: 3000MS
Memory Limit: Unknown
64bit IO Format: %lld & %llu
Submit Status
Description
Problem D: Evil Straw Warts...
分类:
其他好文 时间:
2015-04-03 09:22:28
阅读次数:
134
题意:判断一个串能否通过临近的两个字符多次交换变成回文串,不能输出“Impossible”,能的话输出最少的交换次数。
思路:预处理每个字母出现的次数,若有>=2个字母出现的次数是奇数则不可能。然后从两边向中间贪心,每次先固定前端,然后从后端向中间逐步找,直到找到第一个与前端相同字母时break,将找到的字母向后移,加上移动的次数(不知道为什么可以这么做,网上说这样做 和 每次找最优 最后结果是一样的,暂时还没有证明出来)。若碰到个数为奇数的字母时,将它往后顺移,最后它就会在中央位置了。...
分类:
其他好文 时间:
2015-03-31 14:50:46
阅读次数:
118
Problem Description
A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be ...
分类:
其他好文 时间:
2015-03-22 09:24:34
阅读次数:
227
转载请注明出处:http://www.cnblogs.com/fraud/ ——by fraudBook of EvilPaladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area con...
分类:
其他好文 时间:
2015-03-15 10:50:15
阅读次数:
150
前言:
原本纠结于Web 模板,选了Handlebars。后来发现页面都是弱逻辑的,不支持复杂逻辑表达式。几乎要放弃之际,想起了Javascript中eval函数。虽然eval函数很强大,强大到可以“凭空”生成对象或执行代码,但总觉得他破坏了代码的优雅性。加之"eval"和"evil"(邪恶)长得挺像的。Eval函数的印象不太好,大多数时候将其当做"禁手"。这时候反正也没有什么好办法了。通过...
分类:
Web程序 时间:
2015-02-28 14:37:07
阅读次数:
129