2015年11月1日
摘要: 最大子段和问题(Maximum Interval Sum)(有时也称LIS)经典的动态规划问题,几乎所有的算法教材都会提到.本文将分析最大子段和问题的几种不同效率的解法,以及最大子段和问题的扩展和运用.一.问题描述 给定长度为n的整数序列,a[1…n], 求[1,n]某个子区间[i... 阅读全文
posted @ 2015-11-01 19:51 cnxo 阅读(417) 评论(0) 推荐(0) 编辑
摘要: Problem Description 用1,2,…,n表示n个盘子,称为1号盘,2号盘,…。号数大盘子就大。经典的汉诺塔问 题经常作为一个递归的经典例题存在。可能有人并不知道汉诺塔问题的典故。汉诺塔来源于 印度传说的一个故事,上帝创造世界时作了三根金刚石柱子,在一根柱子上从下往上... 阅读全文
posted @ 2015-11-01 19:01 cnxo 阅读(558) 评论(0) 推荐(0) 编辑
摘要: 错排问题 错排问题 就是一种递推式,不过它比较著名且常用,所以要熟记!错排问题:有n个正整数1,2,3,……n,将这n个正整数重新排列,使其中的每一个数都不在原来的位置上,这种排列称为正整数1,2,3,……n的错排,问这n个正整数的排个数是多少? 设这n个正整数的错排个数为an,为... 阅读全文
posted @ 2015-11-01 12:22 cnxo 阅读(1062) 评论(0) 推荐(0) 编辑
  2015年10月31日
摘要: Problem Description A DFS(digital factorial sum) number is found by summing the factorial of every digit of a positive integer. For example ,... 阅读全文
posted @ 2015-10-31 14:31 cnxo 阅读(123) 评论(0) 推荐(0) 编辑
  2015年10月30日
摘要: DescriptionA boolean matrix has the parity property when each row and each column has an even sum, i.e. contains an even number of bits which... 阅读全文
posted @ 2015-10-30 20:37 cnxo 阅读(220) 评论(0) 推荐(0) 编辑
摘要: Problem Description Ray又对数字的列产生了兴趣: 现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。Input 每组数据占一行,代表四张卡片上的数字(0#include#includeint a[6],vis[5],t,s... 阅读全文
posted @ 2015-10-30 13:48 cnxo 阅读(148) 评论(0) 推荐(0) 编辑
  2015年10月29日
摘要: Description A palindrome is a symmetrical string, that is, a string read identically from left to right as well as from right to left. You ar... 阅读全文
posted @ 2015-10-29 14:03 cnxo 阅读(138) 评论(0) 推荐(0) 编辑
  2015年10月26日
摘要: DescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). I... 阅读全文
posted @ 2015-10-26 19:01 cnxo 阅读(120) 评论(0) 推荐(0) 编辑
摘要: Problem Description 统计给定文本文件中汉字的个数。Input 输入文件首先包含一个整数n,表示测试实例的个数,然后是n段文本。Output 对于每一段文本,输出其中的汉字的个数,每个测试实例的输出占一行。[Hint:]从汉字机内码的特点考虑~Sample Inp... 阅读全文
posted @ 2015-10-26 18:55 cnxo 阅读(148) 评论(0) 推荐(0) 编辑
摘要: Problem Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a ... 阅读全文
posted @ 2015-10-26 18:51 cnxo 阅读(124) 评论(0) 推荐(0) 编辑