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 00448085_1 at 2005-03-18 15:45:22 on Problem 1657
#include<iostream.h>
#include<math.h>

int max ( int , int );

int main ()
{
	int t, i, a, b;
	char * sp1, *edp1;
	int *sp2, *edp2;
	int king, queen, vichle, eleph;

	cin >> t;
	
	sp1 = new char[t];
	edp1 = new char[t];
	sp2 = new int[t];
	edp2 = new int[t];
    
	for ( i = 0; i < t; i++ ){
		cin >> sp1[i] >> sp2[i]
			>> edp1[i] >> edp2[i];
	}
  
	for ( i = 0; i < t; i++ ){
		a = abs(sp1[i] - edp1[i]);
		b = abs(sp2[i] - edp2[i]);

		if ( a == 0){
			king = b;
			queen = vichle = 1;
			cout << king << " " 
				 << queen << " " 
				 << vichle << " "
				 << "Inf\n";
		}
	   else	if ( b == 0 ){
			king = a;
			queen = vichle = 1;
			cout << king << " " 
				 << queen << " " 
				 << vichle << " "
				 << "Inf\n";
		}
	   else if ( a == b ){
		   king = a;
		   queen = eleph = 1;
		   vichle = 2;
		   cout << king << " "
			    << queen << " "
				<< vichle << " "
				<< eleph << endl;
	   }
	   else {
		   king = max(a, b);
		   queen = vichle = eleph = 2;
		   cout << king << " "
			    << queen << " "
				<< vichle << " "
				<< eleph << endl;
	   }
	 }
	  return 0 ;
}

int max ( int a, int b )
{
	if ( a > b )
		return a;
	else
		return b;
}

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