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 |
跪求解释#include<iostream> #include<stdio.h> using namespace std; int p[110][110];//如果p在main函数里定义会wa,求解释 int main() { int i,j,k,max1,f,v,dp[110]={0}; scanf("%d%d",&f,&v); for(i=0;i<f;i++) { for(j=0;j<v;j++) { scanf("%d",&p[i][j]); } } for(i=0;i<f;i++) { for(j=v-1;j>=i;j--) { max1=-100000; for(k=j-1;k>=i-1;k--) { if(max1<dp[k])max1=dp[k]; } if(j==0)max1=0; dp[j]=max1+p[i][j]; } } max1=-100000; for(i=f-1;i<v;i++) { if(max1<dp[i])max1=dp[i]; } cout<<max1<<endl; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator