先介绍八数码问题: 我们首先从经典的八数码问题入手,即对于八数码问题的任意一个排列是否有解?有解的条件是什么? 我在网上搜了半天,找到一个十分简洁的结论.八数码问题原始状态如下: 1 2 3 4 5 6 7 8 为了方便讨论,我们把它写成一维的形式,并以0代替空格位置.那么表示如下: 1 2 3 4 5 6 7 8 0 通过实验得知,以下状态是无解的(交换了前两个数字1 2): 2 1 3 4 5 6 7 8 0 八数码问题的有解无解的结论: 一个状态表示成一维的形式,求出除0之外所有数字的逆序…
hdu 2451 Simple Addition Expression Problem Description A luxury yacht with 100 passengers on board is sailing on the sea in the twilight. The yacht is ablaze with lights and there comes out laughers and singing from the hall where an evening party i…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3743 题目意思就是给你一个长为n的序列,让你求逆序对.我用的是归并排序来求的.归并排序有一个合并的过程,分前后两段,当a[i] > a[j]时,说明a[j]比前面那段啊[i],a[i+1],a[i+2]....,a[mid],比这些都要小,所以总逆序对数要加上mid-i+1. // File Name: HDU3743.cpp // Author: xiaxiaosheng // Created T…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4662 MU Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1296    Accepted Submission(s): 539 Problem Description Suppose there are the symbo…
主题链接:http://acm.hdu.edu.cn/showproblem.php?pid=2451 Problem Description A luxury yacht with 100 passengers on board is sailing on the sea in the twilight. The yacht is ablaze with lights and there comes out laughers and singing from the hall where an…
Inversion                                                                             Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Problem Description bobo has a sequence a1,a2,-,an. He is allowed to swap two …
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4662 题意: 初始字符串为"MI". 有三个操作: (1)将'M'之后的所有字符翻倍.For example: MIU to MIUIU. (2)将'III'变为一个'U'.For example: MUIIIU to MUUU. (3)删除'UU'.For example: MUUU to MU 给你一个字符串s,问你是否能将初始字符串"MI"通过一系列操作变为s.…
链接 [http://acm.hdu.edu.cn/showproblem.php?pid=1098] 分析: 数学归纳法 f(1) = 18 + ka; 假设f(x) = 5x^13+13x^5+kax 能被65整除 f(x+1) = 5(x+1)^13+13(x+1)^5+ka(x+1) 根据二项式定理展开 (a+b)^n = C(n,0)a^nb^0 + C(n,1)a^(n-1)b^1 + C(n,2)a^(n-2)b^2 + ... + C(n,n)a^0b^n f(x+1) = 5…
Simple Function Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 111    Accepted Submission(s): 31 Problem Description Knowing that x can be any real number that x2 + Dx + E ≠ 0. Now, given the f…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4662 题目是问目标串能否由MI得到,我们可以逆向思维,目标串能否反过来处理得到MI,所以,首先排除M没有出现或者出现超过一次,或者只出现了一次但没有出现在第一个位置的情形····也就是说只剩下第一个位置是M,然后不再出现M的情形···· 接下来思考如何得到I,既然要得到I,U必然要化成I,一个U相当于3个I,接下来还可以每次添加UU,相当于添加了6个I,这样当I的个数能凑成2^k,k>=0时,就是…