码迷,mamicode.com
首页 >  
搜索关键字:jump game ii    ( 12386个结果
【leetcode】Unique Paths II
题目:与版本一不同的是,这里给定了一个矩阵,矩阵中元素为0的点表示该点可达,为1的点表示不可达,当然,不可达也就意味着不可经过。以左上角为出发点,右下角为目标终点,可行的不同路径有多少。 分析: 在Uniqu Paths I 的基础上,加上对矩阵可达性的判断就可以了。 注意: 1.左上角的元素是1的时候,即出发点就不可达,即出发不了,倒在了起跑线上。 2.给定的矩阵是1*1的形式。 3...
分类:其他好文   时间:2014-05-26 05:48:24    阅读次数:247
hdu 3081 Marriage Match II(最大流 + 二分 + 并查集)
Marriage Match II                                                                           Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Descript...
分类:其他好文   时间:2014-05-26 04:40:15    阅读次数:228
UVA 10843 - Anne's game(Cayley定理)
UVA 10843 - Anne's game 题目链接 题意:题意说得挺绕的,其实本质上就是求n个点,可以接连出多少种不同的生成树 思路:这是Caylay定理,网上能找到证明,结果为nn?2,然后利用快速幂去求解。 代码: #include #include const int long long MOD = 2000000011; int t; long long n;...
分类:其他好文   时间:2014-05-26 03:36:35    阅读次数:278
Red and Black
1 #include 2 #include 3 int D,SIGN,Len_X,Len_Y; 4 char Map[100][100]; 5 int Sign[100][100]; 6 7 int Sign_Part(int x,int y) 8 { 9 10 int ii,jj;...
分类:其他好文   时间:2014-05-25 19:36:58    阅读次数:265
acd The Game about KILL(和约瑟夫归则一样,归律)
Problem Description Teacher HU and his 40 students were trapped by the brigands. To show their power, the head of the brigands want to select one people to kill. Teacher HU and his 40 students wil...
分类:其他好文   时间:2014-05-25 10:02:35    阅读次数:309
POJ1753——Flip Game
Flip GameDescriptionFlip game is played on a rectangular 4x4 field with two-sided pieces placed on each of its 16 squares. One side of each piece is w...
分类:其他好文   时间:2014-05-25 03:21:52    阅读次数:255
LeetCode: N-Queens II [051]
【题目】 Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct solutions. 【题意】 解N皇后问题,N-Queens要求返回所有的解,而本题只需要返回可行解的数目 【思路】 DFS,参考N-Queens...
分类:其他好文   时间:2014-05-25 01:51:55    阅读次数:236
LeetCode: Jump Game [054]
【题目】 Given an array of non-negative integers, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. For example:...
分类:其他好文   时间:2014-05-24 20:44:39    阅读次数:221
【leetcode】Best Time to Buy and Sell Stock II
问题:股票交易,交易的次数不限,但是要求在购买新的股票前,必须将旧的股票卖出,即同一时间,最多只能持有一只股票。要求在给定的交易价格序列中,计算出最大的收益。 分析: 保证利润最大,就要求在局部的价格波动中,能在低价买进,高价卖出,也就是说,找个价格走势的递增区间,并且这里可以交易多次,所以可以找到多个价格走势的递增区间,所有区间的收益的和就是最大的利润。 再看下不完全是递增区间的...
分类:其他好文   时间:2014-05-24 19:49:02    阅读次数:349
Leetcode的bug测试用例 ?? jump game
之所以说leetcode的测试用例有问题,是因为我刚开始理解错了题意,写下了如下的错误的代码。但是却AC了。 错误代码为: bool canJump(int A[], int n) { if(n == 0) return true; int sum = 0; //记录当前的最远距离 int i = 0; ...
分类:其他好文   时间:2014-05-24 19:45:57    阅读次数:1081
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!