随笔分类 - 动态规划
摘要:Problem DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14.InputThe first line of the input contains an integer T(1<=T<=20) which means the number
阅读全文
摘要:Problem Description给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 using namespace std;int a[10000];int main(){ int k,j; int i; int p,q,p1; int sum,ans; while(cin>>k) { if(k==0) break; sum=0; j=0; p1=0; for(i=0;i>a[i]; if(...
阅读全文
摘要:Problem DescriptionThe 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 the lucrative business of bank robbery only for a short while, before retiring to a comfortabl
阅读全文

浙公网安备 33010602011771号