Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
官方数据过了,但还是WA,各位牛人帮忙看一下....#include<stdio.h> #define N 100 int main() { int a[N][N];// aesthetic values in each vase int s[N][N]={0};//maximize the sum of aesthetic values for the subarrangement int v,f;//the number of vases ,the bunches of flowers int i,j,k,max; scanf("%d%d",&f,&v); for(i=0;i<f;i++) for(j=0;j<v;j++) scanf(" %d",*(a+i)+j);//get the aesthetic values for(i=0;i<v;i++) s[0][i]=a[0][i]; for(i=1;i<f;i++) for(j=i;j<=i+v-f;j++)//for(j=i;j<i+f;j++) { max=0; for(k=i-1;k<j;k++) if(max<s[i-1][k]) max=s[i-1][k]; s[i][j]=a[i][j]+max; } for(i=f-1;i<v;i++) if(max<s[f-1][i]) max=s[f-1][i]; printf("%d\n",max); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator