打算专题训练下DP,做一道帖一道吧~~现在的代码风格完全变了~~大概是懒了.所以.将就着看吧~哈哈 Description The aspiring Roy the Robber has seen a lot of American movies, and knows that the bad guys usually gets caught in the end, often because they become too greedy. He has decided to work in t…
Max Sum Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 154155 Accepted Submission(s): 35958 Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max su…
最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 18603 Accepted Submission(s): 8268 Problem Description 给定K个整数的序列{ N1, N2, ..., NK }.其随意连续子序列可表示为{ Ni, Ni+1, ..., Nj }.当中 1 <= i <= j…
HDU1003 HDU1231 题意自明.可能是真的进步了点,记得刚开始研究这个问题时还想了好长时间,hdu 1231还手推了很长时间,今天重新写干净利落就AC了. #include<iostream> #include<cstring> #include<cstdio> #include<algorithm> using namespace std; ; int a[MAXN]; int main() { int T,N; scanf("%d&q…
Description Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now. The game can be played by two or more than two…
Description A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows the histogram that consists of rectang…
题目(1231) #include<stdio.h> #include<iostream> using namespace std; int main() { int K,num[10010],cnt; int end,start,thisMax,Max,temp; while(cin>>K&&K) { cnt=0; for( int i=0; i<K; i++) { scanf("%d",&num[i]); if(nu…
和前面两道题一样 不过这题要求输出子序列首尾的元素的值,而且如果所有元素都小于0的话,规定子序列的和为0,并输出整个序列的首尾元素. //#define LOCAL #include <iostream> #include <cstdio> #include <cstring> using namespace std; + ; int a[maxn]; struct Node { int w; int l, r; }node[maxn]; int main(void)…
题意:给定一组数,求最大的连续和,且输出开始与结尾 #include<iostream> #include<cstdio> using namespace std; int s[10011]; int main(){ int k,n,i,j,maxn,start,end; while(cin>>n,n){ maxn=-100; k= start = end = j = 0; for(i=0;i<n;i++){ scanf("%d",s+i);…
pid=1231">最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 18461 Accepted Submission(s): 8202 Problem Description 给定K个整数的序列{ N1, N2, ..., NK },其随意连续子序列可表示为{ Ni, Ni+1, ..., Nj },当中…
http://acm.hdu.edu.cn/showproblem.php?pid=1231 最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 23789 Accepted Submission(s): 10638 Problem Description 给定K个整数的序列{ N1, N2, ..., NK },其任意…