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 <iostream> using namespace std; int main(int argc, char* argv[]) { //freopen("debug\\in.txt","r",stdin); int F=0,V=0; int range[110][110]; int dt[110][110]; int i,j,k; while(cin>>F>>V) //这里要不要多次输入都wa { // memset(range,0,sizeof(range)); // memset(dt,0,sizeof(dt)); for(i=0;i<F;i++) { for(j=0;j<V;j++) { cin>>range[i][j]; } } for(k=0;k<V;k++) { dt[F-1][k]=range[F-1][k]; } for(i=F-2;i>=0;i--) { for(j=i;j<=V-F+i;j++) { int maxdt=-9999999; for(k=j+1;k<F+i+1;k++) { if(maxdt<dt[i+1][k]) maxdt=dt[i+1][k]; } dt[i][j]=maxdt+range[i][j]; } } int result=-9999999; for(i=0;i<=V-F;i++) { if(dt[0][i]>result) result=dt[0][i]; } cout<<result<<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