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

兄弟,帮帮忙

Posted by beijing2008 at 2006-05-06 14:14:07 on Problem 1657
#include<stdio.h>
#include<iostream.h>
#include<math.h>
int main()
{
	int n,dx,dy;char d1[2],d2[2];
	scanf("%d",&n);
	while(n--)
	{
		cin>>d1>>d2;
		dx=abs(d1[0]-d2[0]);
		dy=abs(d1[1]-d2[1]);
		if((dx==0)&&(dy==0)) cout<<"0 0 0 0"<<endl;
		else
		{
			if(dx>dy) cout<<dx<<" ";
			else cout<<dy<<" ";
			if(dx==0||dy==0||dx==dy) cout<<"1 ";
			else cout<<"2 ";
			if(dx==0||dy==0) cout<<"1 ";
			else cout<<"2 ";
			if((abs(dx-dy))%2==1||(dx%2==1&&dy%2==0)) cout<<"Inf"<<endl;
			else 
				if(dx==dy) cout<<"1"<<endl;
				else cout<<"2"<<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