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 meryhello at 2005-02-24 22:59:29 on Problem 1657
#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int king(int a,int b);
int queen(int a,int b);
void main()
{
	char str1[2],str2[2];
	int times,a,b;
	cout<<"how many times you want to try?";
	cin>>times;
	for(int i=0;i<times;i++)
	{
		cout<<endl<<"please key in the location from start to the end:"<<endl;
		cin>>str1;
		cin>>str2;
		a=fabs(str1[0]-str2[0]);
		b=fabs(str1[1]-str2[1]);
		if((a==0)&&(b==0))
			cout<<0<<" "<<0<<" "<<0<<" "<<0;
		else
		{
			if(a>b)
				cout<<a<<" ";
			else 
				cout<<b<<" ";
			if((a==b)||(a==0)||(b==0))
				cout<<1<<" ";
			else
				cout<<2<<" ";
			if((a==0)||(b==0))
				cout<<1<<" ";
			else
				cout<<2<<" ";
			if(a==b)
				cout<<1;
			else 
				if((a-b)%2==0)
					cout<<2;
				else
					cout<<"Inf";
		}
	}
	cout<<endl;
}
我已经提交3次,全部退回……郁闷啊……




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