随笔分类 -  动态规划

摘要:「长乐集训 2017 Day10」划分序列 「长乐集训 2017 Day10」划分序列 「长乐集训 2017 Day10」划分序列 题目描述 给定一个长度为 n nn 的序列 Ai A_iA​i​​,现在要求把这个序列分成恰好 K KK 段,(每一段是一个连续子序列,且每个元素恰好属于一段),并且每 阅读全文
posted @ 2017-10-03 23:55 贱人方 阅读(645) 评论(0) 推荐(0)
摘要:题目链接:传送门 【题意】有n个灯,m个开关,灯的编号从1~n,每个开关上有一个质数,这个开关同时控制编号为这个质数的倍数的灯,问最多有多少灯打开。 【分析】发现小于根号1000的质数有10个左右,然后大于根号1000的质数所控制的灯是不会重叠的,所以我们状压枚举小于31的质数,然后贪心后面的。 阅读全文
posted @ 2017-10-01 11:54 贱人方 阅读(497) 评论(0) 推荐(0)
摘要:Corn Fields Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 16773 Accepted: 8860 Description Farmer John has purchased a lush new rectangul 阅读全文
posted @ 2017-10-01 10:12 贱人方 阅读(278) 评论(0) 推荐(0)
摘要:E. Fire time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp is in really serious tr 阅读全文
posted @ 2017-09-26 16:56 贱人方 阅读(235) 评论(0) 推荐(0)
摘要:#1580 : Matrix #1580 : Matrix 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 Once upon a time, there was a little dog YK. One day, he went to an antique shop a 阅读全文
posted @ 2017-09-23 20:49 贱人方 阅读(402) 评论(0) 推荐(0)
摘要:gems gems gems Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 895 Accepted Submission(s): 167 Pr 阅读全文
posted @ 2017-09-11 22:50 贱人方 阅读(301) 评论(0) 推荐(0)
摘要:transaction transaction transaction Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others)Total Submission(s): 895 Accepte 阅读全文
posted @ 2017-09-11 22:42 贱人方 阅读(229) 评论(0) 推荐(0)
摘要:整数划分 将N分为若干个不同整数的和,有多少种不同的划分方式,例如:n = 6,{6} {1,5} {2,4} {1,2,3},共4种。由于数据较大,输出Mod 10^9 + 7的结果即可。 将N分为若干个不同整数的和,有多少种不同的划分方式,例如:n = 6,{6} {1,5} {2,4} {1, 阅读全文
posted @ 2017-08-17 10:40 贱人方 阅读(165) 评论(0) 推荐(0)
摘要:最大M子段和 N个整数组成的序列a[1],a[2],a[3],…,a[n],将这N个数划分为互不相交的M个子段,并且这M个子段的和是最大的。如果M >= N个数中正数的个数,那么输出所有正数的和。 例如:-2 11 -4 13 -5 6 -2,分为2段,11 -4 13一段,6一段,和为26。 N个 阅读全文
posted @ 2017-08-17 10:35 贱人方 阅读(145) 评论(0) 推荐(0)
摘要:Two Paths time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output Two Paths time limit per test 2 阅读全文
posted @ 2017-08-12 10:04 贱人方 阅读(189) 评论(0) 推荐(0)
摘要:D. Valid Sets time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output D. Valid Sets time limit pe 阅读全文
posted @ 2017-08-11 15:14 贱人方 阅读(277) 评论(0) 推荐(0)
摘要:Strip time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Alexandra has a paper strip with n  阅读全文
posted @ 2017-08-09 22:24 贱人方 阅读(285) 评论(0) 推荐(0)
摘要:Queries for Number of Palindromes time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standard output You've 阅读全文
posted @ 2017-08-09 20:14 贱人方 阅读(339) 评论(0) 推荐(0)
摘要:RXD, tree and sequence Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 234 Accepted Submission( 阅读全文
posted @ 2017-08-02 23:08 贱人方 阅读(544) 评论(0) 推荐(0)
摘要:Letter time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Patrick has just finished writing 阅读全文
posted @ 2017-07-23 22:08 贱人方 阅读(343) 评论(0) 推荐(0)
摘要:Riding in a Lift time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Imagine that you are in 阅读全文
posted @ 2017-07-23 22:03 贱人方 阅读(302) 评论(0) 推荐(0)
摘要:Greenhouse Effect time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Emuskald is an avid ho 阅读全文
posted @ 2017-07-23 21:39 贱人方 阅读(282) 评论(0) 推荐(0)
摘要:Tetrahedron time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a tetrahedron. 阅读全文
posted @ 2017-07-23 21:24 贱人方 阅读(224) 评论(0) 推荐(0)
摘要:Quasi Binary time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Quasi Binary time limit per 阅读全文
posted @ 2017-07-23 21:06 贱人方 阅读(201) 评论(0) 推荐(0)
摘要:Cut Ribbon time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Cut Ribbon time limit per test 阅读全文
posted @ 2017-07-23 20:59 贱人方 阅读(262) 评论(0) 推荐(0)