地址:http://acm.hdu.edu.cn/showproblem.php?pid=1231题意:中文。最大连续子川和。经典dp(不知道算不算dp)。代码:# include <stdio.h>int a[10010] ;int n, s, e, max_sum ;void find(){ int i, ss = s, ee = e, sum = max_sum ; for (i = 1 ; i < n ; i++) { if (sum < 0) ss = ee = sum = a[i] ; else { ...
转载 2012-01-13 02:46:00
39阅读
给定K个整数的序列{ N1, N2, ..., NK },
原创 2023-06-28 19:22:06
53阅读
Problem Description 给定K个整数的序列{ N1, N2, ..., NK },其任意连续子序列可表示为{ Ni, Ni+1, ..., Nj },其中 1 <= i <= j <= K。最大连续子序列是所有连续子序列中元素和最大的一个, 例如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{ 11, -4, 13 }
转载 2013-12-03 11:16:00
37阅读
2评论
View Code #include"iostream"using namespace std;int main(){ int n; int a[10001]; int i; int j=0; while(cin>>n,n)
HDU
原创 2021-07-28 16:53:58
33阅读
最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 31991 Accepted Submission(s): 14326 Probl
原创 2021-07-28 10:14:46
105阅读
最大连续子序列Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 208
原创 2023-02-17 09:28:29
41阅读
题目地址:点击打开链接 思路:水题 AC代码: #include #include #include #include #include #include #include #include #include #include using namespace std; int a[10001]; int main() { int n,i,sum,max1,star
原创 2022-08-04 09:15:23
51阅读
这是一个dp动态规划的题,上次写了一个最长连续子序列,今天又写了一个最大连续子序列,哈哈…题
原创 2023-02-08 10:18:26
57阅读
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1231dp水题;View Code 1 #include<iostream> 2 #include<cstring> 3 const int N=11000; 4 using namespace std; 5 int a[N],dp[N]; 6 7 int main(){ 8 int n; 9 while(scanf("%d",&n)!=EOF&&n){10 memset(dp,0,sizeof(dp));11 memset(a,0
转载 2013-03-10 11:46:00
54阅读
2评论
和前面两道题一样不过这题要求输出子序列首尾的元素的值,而且如果所有元素都小于0的话,规定子序列的和为0,并输出整个序列的首尾元素。 1 //#define LOCAL 2 #include 3 #include 4 #include 5 using namespace std; 6 7 co...
转载 2014-07-24 14:08:00
44阅读
2评论
状态表示:dp[i]是必须以A[i]结尾的连续序列。 那么只有两种情况: 这个最大和的连续序列只有一个元素,即以A[i]开始,以A[i]结尾。 这个最大和的连续序列有多个元素,即从前面某处A[p]开始(p<i),一直到A[i]结尾。 对第一种情况,最大和就是A[i]本身。 对第二种情况,最大和是dp
转载 2021-02-01 19:43:00
93阅读
最大连续子序列 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 22849 Accepted Submission(s): 10135 Prob
转载 2017-05-14 08:08:00
69阅读
2评论
最大连续子序列Time Limit: 2000/1000 MS (Java/Others)    Memor
题目大意:求使连续子序列的和最大的第一元
原创 2014-10-17 21:23:37
48阅读
  最大连续子序列 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18603    Accepted Submission(s): 8268Problem Description 给定K个整数的序列{ N1, N2, ..., NK }
转载 2017-05-10 09:52:00
28阅读
http://acm.hdu.edu.cn/showproblem.php?pid=1231dp入门题#include#include#include#include#include#include#includeusing namespace std;#define MAX 10005int main(){ int dp[ MAX ] ; int n ; while( scanf( "%d" , &n ) != EOF , n ) { int sum = 0 ; int temp = 0 , temp1 = 0 , temp2 = 0 ; int begin ;
转载 2013-07-26 19:10:00
44阅读
2评论
pid=1231">最大连续子序列Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18461Accepted Submission(s): 8202...
转载 2016-01-04 09:50:00
53阅读
最大连续子序列Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 16639    Accepted Submission(s): 7294Problem Description给定K个整数的序列{ N1
题目:http://acm.hdu.edu.cn/showproblem.php?pid=1231欢迎参加——每周六晚的BestCoder(有米!)最大连续子序列Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2
原创 2022-08-23 21:10:11
57阅读
Domestic fresh dairy products will be tested this year to see if they contain leather-hydrolyzed protein and melamine, two banned additives sometimes used to make products appear to have a higher prot
转载 2011-02-23 08:22:38
286阅读
  • 1
  • 2
  • 3
  • 4
  • 5