dp practice 1】的更多相关文章

题目链接 Your algorithms have become so good at predicting the market that you now know what the share price of Wooden Orange Toothpicks Inc. (WOT) will be for the next N days. Each day, you can either buy one share of WOT, sell any number of shares of W…
https://codeforces.com/problemset/problem/553/A dp+组合数学 dp[i] 放前i种颜色的方法数 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e3+7; const ll mod = 1e9+7; int a[N]; ll dp[N],f[N]; void work(){ f[0]=1; f[1]=1; for(int i=2;…
Summer Practice Report dp[ i ][ 0 ]表示放完前 i 页, 第 i 页最后一段是 0, 0个数的最小值. dp[ i ][ 1 ]表示放完前 i 页, 第 i 页最后一段是 1, 1个数的最小值. 这个转移细节有点多... #include<bits/stdc++.h> #define LL long long #define LD long double #define fi first #define se second #define mk make_pa…
Trade Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 3401 Appoint description:  Description Recently, lxhgww is addicted to stock, he finds some regular patterns after a few days' study.  He fo…
Maximum Subarray Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2,1,−5,4],the contiguous subarray [4,−1,2,1] has the largest sum = 6. More practice:…
B - Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1069 Appoint description: Description A group of researchers are designing an experiment to test the IQ of a monkey. They wi…
G - FatMouse's Speed Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1160 Appoint description: Description FatMouse believes that the fatter a mouse is, the faster it runs. To disprove this, you…
G - Simple String Problem Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice FZU 2218 Description Recently, you have found your interest in string theory. Here is an interesting question about strings.…
B - Strategic Game Time Limit:10000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1054 Description Bob enjoys playing computer games, especially strategic games, but sometimes he cannot find the solution fast…
A - Anniversary party Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1520 Description There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The Universit…
F - 巡了南山我巡北山 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice FZU 2172 Description 大师兄在取经途中迷上了ACM-ICPC,稍不留神,师傅就被妖怪抓走了. 大师兄并不着急去救师傅,在虐这道简单题: 有两个字符串A和B,每一次可以选择以下操作中的一种,只对字符串A进行操作,用最少的操作使得字符串A与字符串B相等: 在…
测试样例之间输出空行,if(t>0) cout<<endl; 这样出最后一组测试样例之外,其它么每组测试样例之后都会输出一个空行. dp[i]表示以a[i]结尾的最大值,则:dp[i]=max(dp[i]+a[i],a[i]) 解释: 以a[i]结尾的最大值,要么是以a[i-1]为结尾的最大值+a[i],要么是a[i]自己本身,就是说,要么是连同之前的 构成一个多项的字串,要么自己单独作为一个字串,不会有其他的可能了. 状态规划的对状态的要求是:当前状态只与之前的状态有关,而且不影响下一…
 Marriage Ceremonies Time Limit:2000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1011 Description You work in a company which organizes marriages. Marriages are not that easy to be made, so, the job is qu…
Y - How many ways Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1978 Appoint description: Description 这是一个简单的生存游戏,你控制一个机器人从一个棋盘的起始点(1,1)走到棋盘的终点(n,m).游戏的规则描述如下: 1.机器人一开始在棋盘的起始点并有起始点所标有的能量. 2.机器…
M - I NEED A OFFER! Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1203 Appoint description:  System Crawler  (2015-11-20) Description Speakless很早就想出国,现在他已经考完了所有需要的考试,准备了所有要准备的材料,于是,便需要去申请学校了.要…
L - 免费馅饼 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1176 Appoint description:  prayerhgq  (2015-07-28) System Crawler  (2015-11-21) Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼.…
H - Super Jumping! Jumping! Jumping! Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1087 Appoint description:  System Crawler  (2015-11-18) Description Nowadays, a kind of chess game called “Su…
E - Largest Rectangle in a Histogram Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1506 Appoint description: Description A histogram is a polygon composed of a sequence of rectangles aligned a…
A - Robberies Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 2955 Appoint description: Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usu…
E - Eternal Reality Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Practice ZOJ 3741 Description In Academy City, most students have special abilities. Such as Railgun, Teleport, Telekinesis, AIM Stalker and…
如果可以每个物品拿多件,则从小到大遍历,否则从大到小遍历. G - Piggy-Bank Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1114 Description Before ACM can do anything, a budget must be prepared and the necessary financial su…
Rating Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4870 Description A little girl loves programming competition very much. Recently, she has found a new kind of programming competition named…
最少拦截系统 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1257 Appoint description:  System Crawler  (2015-09-07) Description 某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都…
FatMouse's Speed Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1160 Appoint description:  prayerhgq  (2015-07-28) System Crawler  (2015-09-05) Description FatMouse believes that the fatter a m…
Tickets Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1260 Appoint description:  System Crawler  (2015-09-06) Description Jesus, what a great movie! Thousands of people are rushing to the cine…
免费馅饼 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1176 Appoint description:  prayerhgq  (2015-07-28) System Crawler  (2015-09-05) Description 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼.说来ga…
Super Jumping! Jumping! Jumping! Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1087 Appoint description:  System Crawler  (2015-09-05) Description Nowadays, a kind of chess game called “Super…
Piggy-Bank Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1114 Appoint description:  System Crawler  (2015-09-06) Description Before ACM can do anything, a budget must be prepared and the neces…
Monkey and Banana Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1069 Appoint description:  prayerhgq  (2015-08-04) System Crawler  (2015-09-05) Description A group of researchers are designing…
Max Sum Plus Plus Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 1024 Appoint description:  System Crawler  (2015-09-05) Description Now I think you have got an AC in Ignatius.L's "Max Sum&…