Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Help! 为什么在JOJ上面提交总是WA?

Posted by kakarrot at 2009-10-08 18:00:12 on Problem 1157 and last updated at 2009-10-09 20:22:40
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator