题目:和上一题类似,就是这个时候给定了矩阵包含0和1,1代表不能从这里走。我的想法其实很明确,还是用动态规划,只是碰到壁垒的时候要进行考虑。还有初始化很重要。因为1本来是要用来代表在这里出发到终点有一种可能的,所以壁垒的1要用其他代替,我用-1代表是壁垒。如果给定的数组第一个数就是1,那永远都出发不...
分类:
其他好文 时间:
2014-11-08 00:50:30
阅读次数:
259
问题描述:
Follow up for "Unique Paths":
Now consider if some obstacles are added to the grids. How many unique paths would there be?
An obstacle and empty space is marked as 1 and
0 respectively in ...
分类:
其他好文 时间:
2014-11-07 20:56:34
阅读次数:
272
该题做法同 Binary Tree Level Order Traversal II,不过是结果没有反转就是了,详细见 http://blog.csdn.net/zzucsliang/article/details/40841527...
分类:
其他好文 时间:
2014-11-07 20:52:02
阅读次数:
139
Hearthstone II
Time Limit: 2000ms Memory limit: 65536K 有疑问?点这里^_^
题目描述
The new season has begun, you have n competitions and m well prepared decks during the new season. Each c...
分类:
其他好文 时间:
2014-11-07 20:49:50
阅读次数:
282
题目连接:hdu 5087 Revenge of LIS II
题目大意:给定一个序列,求第2长的LIS长度。
解题思路:用o(n^2)的算法求LIS,每个位置维护两个值,最大和最小即可。注意的是dp[0]中的最大第二大不能都复制成0.
#include
#include
#include
using namespace std;
const int maxn = 1005...
分类:
其他好文 时间:
2014-11-07 19:12:01
阅读次数:
244
题目链接:hdu 5088 Revenge of Nim II
题目大意:Nim游戏的变形,因为游戏很不公平,所以现在转变规则,后手可以选取若干堆石子剔除,剩下堆的石子用
来进行游戏,问说后手可能胜利吗。
解题思路:其实即为取出非0堆石子,使得Nim和为0。因为是Nim和(亦或),所以以每个位建立方程,列出40个方
程,进行亦或形式的高斯消元,因为全0肯定为一解,所以方程肯...
分类:
其他好文 时间:
2014-11-07 19:11:41
阅读次数:
289
Find Minimum in Rotated Sorted Array IIFollow up for "Find Minimum in Rotated Sorted Array": What if duplicates are allowed?Would this affect the run-...
分类:
其他好文 时间:
2014-11-07 16:47:41
阅读次数:
233
点击打开链接链接
Revenge of LIS II
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1028 Accepted Submission(s): 334
Problem Description...
分类:
其他好文 时间:
2014-11-06 22:04:56
阅读次数:
128
Problem Description
In computer science, the longest increasing subsequence problem is to find a subsequence of a given sequence in which the subsequence's elements are in sorted order, lowest to hig...
分类:
其他好文 时间:
2014-11-06 21:57:19
阅读次数:
187
使用在线编辑器的好处:I 提供各种在线JS或css框架II 实时预览代码效果III 线上保存代码IIII可分享 下面推荐几款很不错的在线前端编辑器1.jsfiddle界面简洁 支持登录保存代码 但不能实时预览 支持emmetDemo:http://jsfiddle.net/m/rdb/2.jsbi....
分类:
其他好文 时间:
2014-11-06 14:32:15
阅读次数:
236