上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 40 下一页
摘要: 题目链接: http://codeforces.com/problemset/problem/154/A 题意: 给你一个字符串,和若干模板串(长度为2),至少删除多少个字母,使得字符串的字串里面没有模板串。 题解: dp[i][j]表示合法子串s[0...i]的最后一位为j时的最小花费(花费指删除 阅读全文
posted @ 2016-05-05 01:35 fenicnn 阅读(197) 评论(0) 推荐(0)
摘要: 题目链接: http://codeforces.com/problemset/problem/57/C 题意: 给你一个数n,表示有n个数的序列,每个数范围为[1,n],叫你求所有非降和非升序列的个数。 题解: 由于对称性,我们只要求非降序的个数就可以了(n个数全部相等的情况既属于非升也属于非降) 阅读全文
posted @ 2016-05-05 01:18 fenicnn 阅读(417) 评论(0) 推荐(0)
摘要: 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5155 题意: 给n*m的零一矩阵,问它的左视图和正视图都为全1的所有情况。 题解: n,m不超过50,所以可以跑O(n^4); 另dp[i][j]代表前i行(每一行至少放一个,因为这样就可以只考虑列会 阅读全文
posted @ 2016-05-02 00:45 fenicnn 阅读(238) 评论(0) 推荐(0)
摘要: 题目链接: http://poj.org/problem?id=1971 题意: 二维空间给n个任意三点不共线的坐标,问这些点能够组成多少个不同的平行四边形。 题解: 使用的平行四边形的判断条件:对角线互相平分的四边形是平行四边形。 所以我们枚举每一条线段,如果有两条线段的中点是重合的,那么这四个顶 阅读全文
posted @ 2016-05-01 01:25 fenicnn 阅读(461) 评论(0) 推荐(1)
摘要: 题目: C. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output C. Exams time limit per test 阅读全文
posted @ 2016-04-30 23:18 fenicnn 阅读(285) 评论(0) 推荐(0)
摘要: 题目: E. Arthur and Brackets time limit per test 2 seconds memory limit per test 128 megabytes input standard input output standard output E. Arthur and 阅读全文
posted @ 2016-04-30 23:01 fenicnn 阅读(244) 评论(0) 推荐(0)
摘要: 题目: B. Friends and Presents time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have two 阅读全文
posted @ 2016-04-30 22:41 fenicnn 阅读(315) 评论(0) 推荐(0)
摘要: 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5159 题解: 考虑没一个数的贡献,一个数一次都不出现的次数是(x-1)^b,而总的排列次数是x^b,所以每一个数有贡献的次数都是x^b-(x-1)^b,所以最后推导的公式就是: (x^b-(x-1)^ 阅读全文
posted @ 2016-04-29 22:50 fenicnn 阅读(168) 评论(0) 推荐(0)
摘要: 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5154 题解: 有向图判环。 1、用dfs,正在访问的节点标记为-1,已经访问过的节点标记为1,没有访问过的节点标记为0,如果访问到-1的节点说明说有环。 2、拓扑排序。 阅读全文
posted @ 2016-04-29 22:42 fenicnn 阅读(228) 评论(0) 推荐(0)
摘要: 题目链接: hdu: http://acm.hdu.edu.cn/showproblem.php?pid=5617 bc(中文): http://bestcoder.hdu.edu.cn/contests/contest_chineseproblem.php?cid=666&pid=1003 题解: 阅读全文
posted @ 2016-04-29 01:34 fenicnn 阅读(237) 评论(0) 推荐(0)
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 40 下一页