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 huhu at 2006-02-23 15:49:08 on Problem 1657
#include<iostream.h>
void main(){
	int x,a,b,A1,A2,wang,hou,che;
	char c,d,xiang;
	cin>>x;
	for(int i=0;i<x;i++){
		cin>>c>>a>>d>>b;
		if((a>8||a<0)||(b>8||b<0)||(c>'h')||(d>'h'))break;
		if(a==b&&c==d)
			cout<<"0 0 0 0"<<endl;
		if (a>b||a==b) A1=a-b;
		else A1=b-a;
		if(c>d||c==d) A2=c-d;
		else A2=d-c;
		if (A1>A2||A1==A2) wang=A1;
		else int wang=A2;
		if(A1==0||A2==0||A1==A2) hou=1;
		else  hou=2;
		if(A1==0||A2==0) che=1;
		else che=2;
		if((A1-A2)%2==0){
			if(A1-A2==0)xiang='1';
			else xiang='2';
			cout<<wang<<" "<<hou<<" "<<che<<" "<<xiang<<endl;
		}
		else cout<<wang<<" "<<hou<<" "<<che<<" 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