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

弱问:我的代码为何是 wrong answer? 谢谢

Posted by Buffoon_fish at 2009-03-01 16:10:21 on Problem 3224
#include<stdio.h>
#include<memory>
using namespace std;

int a[100+2][100+2];
int grade[100+2];


int main()
{
	int n;
	int i,j;
	int maxg;
	while(scanf("%d",&n) != EOF)
	{
		for(i=0;i<n;i++)   //input
			for(j=0;j<n;j++)
				scanf("%d",&a[i][j]);
        memset(grade,0,sizeof(grade));
		for(i=0;i<n;i++)    
			for(j=0;j<n;j++)
			    grade[i] += a[i][j];
		maxg = grade[0];
		for(i=1;i<n;i++)   //output
			if(grade[i] > maxg)
			{
				j = i;
				maxg = grade[i];
			}
		printf("%d\n",j+1);
	}
	return 1;
}

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