文章分类 - DP
摘要:Common SubsequenceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18332 Accepted Submission(s): 7742Problem DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a seque...
阅读全文
摘要:Monkey and BananaTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6077 Accepted Submission(s): 3091Problem DescriptionA group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a buil...
阅读全文
摘要:Largest Rectangle in a HistogramTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 8484 Accepted Submission(s): 2366Problem DescriptionA histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles h...
阅读全文
摘要:最少拦截系统Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 13598 Accepted Submission(s): 5433Problem Description某国为了防御敌国的导弹袭击,发展出一种导弹拦截系统.但是这种导弹拦截系统有一个缺陷:虽然它的第一发炮弹能够到达任意的高度,但是以后每一发炮弹都不能超过前一发的高度.某天,雷达捕捉到敌国的导弹来袭.由于该系统还在试用阶段,所以只有一套系统,因此有可能不能拦截所有的导弹....
阅读全文
摘要:To the MaxTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 37431 Accepted: 19715DescriptionGiven a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located within the whole array. The sum of a rectangle is the sum o.
阅读全文
摘要:滑雪Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 68987 Accepted: 25450DescriptionMichael喜欢滑雪百这并不奇怪, 因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子 1 2 3 4 516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 9一个人可以从某个...
阅读全文
摘要://31MS 312K 873 B C++//二维DP,状态转移小变化 #include#includeint dp[25][1005];inline int max(int a,int b){ return a>b?a:b;}int main(void){ int t,n,m; scanf("%d",&t); while(t--) { scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) s...
阅读全文
摘要://DP噩梦//对新手来说比较蛋疼的一题,建议先做其他的//31MS 260K 825 B #include #include #define M 1000000struct node{ int a,; int b; double ab;}c[1005];int cmp(const void*a,const void*b){ return (*(node *)b).ab > (*(node *)a).ab?1:-1;}int main(void) { int n,m; while(scanf("%d%d",&n,&m)!=EOF) { ...
阅读全文
摘要://dp,注意转移要领,动手模拟一下#include#define max(a,b) (a>b?a:b)int main(void){ int t,n,a[100005]; int st,et,po; int max,now; int k=1; scanf("%d",&t); while(t--) { scanf("%d",&n); for(int i=1;imax){ max=now; st=po; et=i; } } printf("Case %d:\n%d %d %d\n",k++,max,st,et);
阅读全文

浙公网安备 33010602011771号