题目链接:10497 - Sweet Child Makes Trouble
题意:n个物品,原来物品属于一个地方,现在要把物品重新放回去,问能放几种使得每个物品都与原来位置不同
思路:递推,一开始随便搞了个二维状态,dp[i][j]表示i个物品,有j个位置不同,那么dp[n][n]就是答案,递推式为:
dp[i][j] = 1 (j == 0)
dp[i][j] = (j - 1) * ...
分类:
其他好文 时间:
2014-05-11 20:25:48
阅读次数:
433
Neal is very curious about combinatorial problems, and now here comes a problem about words. Knowing that Ray has a photographic memory and this may not trouble him, Neal gives it to Jiejie.
Since Ji...
分类:
其他好文 时间:
2014-05-10 03:48:22
阅读次数:
352
今天要处理一些数据, 把表格中两列内容并为一列.
我头脑中第一个想法就是,读出这两列数据,用split()函数,按行分开,再输出..... 当时我还洋洋得意,辛亏学了一点编程,要不这些数据不得处理死我.....
呵呵... 脚本写了一半,想到用notepad,把"\t"替换成空格即可. ...
分类:
其他好文 时间:
2014-04-30 16:15:11
阅读次数:
395