Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
wrong answer!我受不了了!请大家帮我看看吧!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator