codeforces George and Job】的更多相关文章

/* 题意:给一个长度为n的序列, 从中选择长度为m的k个区间(任意两个区间不会有公共部分) 使得所选择的区间的和最大! 思路:这是一种很常见的dp dp[i][j] 表示的是前 i 个数选择 j 个 长度为m区间的最大和! s[i]记录的是前 i 个数字的和! dp[i][j] = max( dp[i - 1][j], dp[i - m][j - 1] + s[i] - s[i-m] ); */ #include<iostream> #include<cstdio> #inclu…
题目 Source http://codeforces.com/contest/467/problem/C Description The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced t…
题目链接:http://codeforces.com/contest/387/problem/B 题目意思:给出1-n个问题,以及要满足是good rounde条件下这n个问题分别需要达到的complexity,最后还有George已经准备好的关于这些问题的m个complexity.问George要come up with的问题最少有多少个. 很明显要使问题最少,那么满足每个问题的complexity为一个即可.解决这个问题的关键是要理解这句话:He can simplify any alrea…
题目传送门 /* 题意:选择k个m长的区间,使得总和最大 01背包:dp[i][j] 表示在i的位置选或不选[i-m+1, i]这个区间,当它是第j个区间. 01背包思想,状态转移方程:dp[i][j] = max (dp[i-1][j], dp[i-m][j-1] + sum[i] - sum[i-m]); 在两个for循环,每一次dp[i][j]的值都要更新 */ #include <cstdio> #include <cstring> #include <algorit…
Codeforces Round #267 (Div. 2) C. George and Job题目链接请点击~ The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced the follow…
E. George and Cards   George is a cat, so he loves playing very much. Vitaly put n cards in a row in front of George. Each card has one integer written on it. All cards had distinct numbers written on them. Let's number the cards from the left to the…
题目链接:http://codeforces.com/problemset/problem/467/C 题目意思:给出一条含有 n 个数的序列,需要从中找出 k 对,每对长度为 m 的子序列,使得 找出来的k对序列的总和相同.注意,同一个数不能在两个子序列中. 首先用了很暴力的做法,赛后发现过不了test 5 的时候,就知道需要用到 dp 来做了.看了这个人的提示: 其实看完这个状态转移方程,就觉得这题不太难了. dp[i][j]: 前 i 个数中,选择 j pairs 可以获得的最大和. 那么…
                                              C. George and Job   The new ITone 6 has been released recently and George got really keen to buy it. Unfortunately, he didn't have enough money, so George was going to work as a programmer. Now he faced t…
题目链接:http://codeforces.com/contest/467/problem/C 求k个不重叠长m的连续子序列的最大和. dp[i][j]表示第i个数的位置个序列的最大和. 前缀和一下就好了.空间可以优化,滚动数组就好了. //#pragma comment(linker, "/STACK:102400000, 102400000") #include <algorithm> #include <iostream> #include <cs…
题目链接: 题目 E. George and Cards time limit per test:2 seconds memory limit per test:256 megabytes 问题描述 George is a cat, so he loves playing very much. Vitaly put n cards in a row in front of George. Each card has one integer written on it. All cards had…