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

同一个代码,为什么在G++下AC,而在C++下WA呢?(附代码)

Posted by LyuuSyouHa at 2009-02-15 10:21:40 on Problem 1050
#include<iostream>
using namespace std;

int main()
{
	int n,ans;
	int i,j,k,m;
	int sumline[100],anss[100];
	int data[100][100];

	cin>>n;
	ans=-127;
	for (i=0;i<n;i++)
		for (j=0;j<n;j++)
			cin>>data[i][j];

	for (i=0;i<n;i++)
		for (j=i;j<n;j++)
		{
			for (k=0;k<n;k++)
			{
				anss[k]=0;
				sumline[k]=0;
			}
			for (k=0;k<n;k++)
			{
				for (m=i;m<=j;m++)
					sumline[k]+=data[m][k];
				if (anss[k]>=0)
					anss[k+1]=anss[k]+sumline[k];
				else
					anss[k+1]=sumline[k];
				if (anss[k+1]>ans)	ans=anss[k+1];
			}
		}

	cout<<ans<<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