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

wrong answer!我受不了了!请大家帮我看看吧!

Posted by 00448122 at 2005-03-01 17:29:31 on Problem 1657
#include <iostream>
#include <cmath>
using namespace std;
int pace( char a[2], char b[2] )
{
	int m = 1,n = 2;
	double p = static_cast<double>( b[0]-a[0] );
    double q = static_cast<double>( b[1]-a[1] );
	double x = fabs( p );
	double y = fabs( q );
	if( x==0&&y==0 )
		cout<<"0 "<<"0 "<<"0 "<<"0"<<endl;
    else if( x == y )
		cout<<x<<" "<<m<<" "<<n<<" "<<m<<endl;
	else if( x == 0 )
		cout<<y<<" "<<m<<" "<<m<<" Inf"<<endl;
	else if( y == 0 )
		cout<<x<<" "<<m<<" "<<m<<" Inf"<<endl;
	else cout<<( x>y?x:y )<<" "<<n<<" "<<n<<" Inf"<<endl;
	return 0;
}
int main()
{
	int t;
	char a[2],b[2];
	cin>>t;
	for( int i=1; i<=t; i++ ){
		cin>>a>>b;
		pace( a,b );}
	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