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

【总是error,我虚脱了……HELP!】

Posted by leoyonn at 2005-02-26 13:53:40 on Problem 1657
#include <iostream.h>
#include <math.h>
void main(){
	int nSum;
	int	nRole[20][4]={0,};
	char cLoc1x[20], cLoc2x[20], cLoc1y[20], cLoc2y[20];
	cin>>nSum;
	int i;
	for(i=0; i<nSum; i++)	{
		cin>>cLoc1x[i]>>cLoc1y[i];
		cin>>cLoc2x[i]>>cLoc2y[i];
	}
	for(i=0; i<nSum; i++)	{
		int m=abs((int)cLoc1x[i]-(int)cLoc2x[i]),n=abs((int)cLoc1y[i]-(int)cLoc2y[i]);
		nRole[i][0]=(m>n)?m:n;
		nRole[i][1]=((m==n)||(m==0)||(n==0))?1:2;
		nRole[i][2]=((m==0)||(n==0))?1:2;
		nRole[i][3]=((m%2)==(n%2))?((m==n)?1:2):(-1);
	}
	for(i=0; i<nSum; i++)	{
		cout<<nRole[i][0]<<" "<<nRole[i][1]<<" "<<nRole[i][2]<<" ";
		if(nRole[i][3]!=-1)
			cout<<nRole[i][3]<<" "<<endl;
		else cout<<"Inf "<<endl;
	}
}

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