一切计算机问题,解决方法可以归结为两类:分治和封装。分治是减层,封装是加层。动态规划问题同样可以用这种思路,分治。它可以划分为多个子问题解决,那这样是不是用简单的递归就完成了?也许是的,但是这样会涉及太多的不便的操作。因为子问题有重叠!针对这种子问题有重叠的情况的解决,就是提高效率的关键。所以动态规...
分类:
其他好文 时间:
2014-05-01 10:03:00
阅读次数:
449
唉,看到这题直接想起自己的Day1,还是挺难受的,挺傻一题考试的时候怎么就没弄出来呢……这两天CP让我给他写个题解,弄了不是很久就把这个题给弄出来了,真不知道考试的时候在干嘛。明天就出发去北京了,祝自己APIO顺利吧。
1 /************************************....
分类:
其他好文 时间:
2014-05-01 09:54:40
阅读次数:
354
Problem 1:Given a set of distinct integers, S,
return all possible subsets.Note:Elements in a subset must be in non-descending
order.The solution set ...
分类:
其他好文 时间:
2014-05-01 09:43:43
阅读次数:
414
判断valid,没有更好的方法,只能brute force。 1 class Solution { 2
public: 3 bool isValidSudoku(vector > &board) { 4 5 int n; 6 for (int...
分类:
其他好文 时间:
2014-05-01 08:54:28
阅读次数:
332
Can you find it?
Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/10000 K (Java/Others)
Total Submission(s): 9863 Accepted Submission(s): 2587
Problem Description
Give you...
分类:
其他好文 时间:
2014-04-29 13:33:20
阅读次数:
300
【原题】
1036: [ZJOI2008]树的统计Count
Time Limit: 10 Sec Memory Limit: 162 MB
Submit: 4465 Solved: 1858
[Submit][Status]
Description
一棵树上有n个节点,编号分别为1到n,每个节点都有一个权值w。我们将以下面的形式来要求你对这棵树完成一些操作: I. C...
分类:
其他好文 时间:
2014-04-29 13:31:21
阅读次数:
525
Radar
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2229 Accepted Submission(s): 888
Problem Description
N cities of the Java Kin...
分类:
其他好文 时间:
2014-04-29 13:26:20
阅读次数:
346
Problem Description
In the Wide Web World, Which web server was popular in web site? Apache, nginx, lighttpd? Baidu.com use Apache, and many web sites like 163.com use nginx. Why? Its configuration i...
分类:
其他好文 时间:
2014-04-29 13:24:20
阅读次数:
355
SICP 习题 1.35要求我们证明黄金分割率φ 是变换函数 x => 1+ 1/x 的不动点,然后利用这一事实通过过程fixed-point 计算出φ的值。首先是有关函数的不动点,这个概念需要理解清楚,后面好几道题都是围绕函数不动点展开的。作者在这里设计这些习题的原因也是希望读者可以关注函数不动点。其实有关不动点这个东西我在做习题“1.8”的时候就觉得好奇了。为什么“(x+x/y)/2”会不断逼...
分类:
其他好文 时间:
2014-04-29 13:23:22
阅读次数:
352
链接:http://soj.me/show_problem.php?pid=1007
Description
Mo and Larry have devised a way of encrypting messages. They first decide secretly on the number of columns and write the message (letter...
分类:
其他好文 时间:
2014-04-29 13:23:21
阅读次数:
293