题目连接: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
Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below.For example, given the fol...
分类:
其他好文 时间:
2014-11-06 17:19:34
阅读次数:
189
Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(...
分类:
其他好文 时间:
2014-11-06 16:41:45
阅读次数:
165
GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]...
分类:
其他好文 时间:
2014-11-06 16:27:43
阅读次数:
182
使用在线编辑器的好处:I 提供各种在线JS或css框架II 实时预览代码效果III 线上保存代码IIII可分享 下面推荐几款很不错的在线前端编辑器1.jsfiddle界面简洁 支持登录保存代码 但不能实时预览 支持emmetDemo:http://jsfiddle.net/m/rdb/2.jsbi....
分类:
其他好文 时间:
2014-11-06 14:32:15
阅读次数:
236
给定一个二叉树,由自底向上的层次顺序遍历返回其节点的值。...
分类:
其他好文 时间:
2014-11-06 00:44:14
阅读次数:
209