| ||||||||||
| 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 | |||||||||
Help! 为什么在JOJ上面提交总是WA?http://acm.jlu.edu.cn/joj/showproblem.php?pid=1832
在这个上面就是过不去,总是WA,为什么呢?
下面是我的代码:
#include <iostream>
#include <stdlib.h>
#define MAX 100
using namespace std;
int main()
{
int F,V,a[MAX][MAX];
while(cin>>F>>V)
{
memset(a,-50*F,sizeof(a));
for(int i=0;i<F;++i)
{
for(int j=0;j<V;++j)
{
cin>>a[i][j];
}
}
for(int i=1;i<F;++i)
{
for(int j=i;j<V;++j)
{
int max=-50*F;
for(int k=0;k<j;++k)
{
if(max<a[i-1][k])
{
max=a[i-1][k];
}
}
a[i][j]+=max;
}
}
int max=-50*F;
for(int i=0;i<V;++i)
{
if(max<a[F-1][i])
{
max=a[F-1][i];
}
}
cout<<max<<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