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

我都疯了,编了两天两夜,n个人看过的程序都没问题还是wrong answer,大虾帮看看啊

Posted by cpp00548279 at 2006-02-26 23:33:21 on Problem 1657
#include <iostream.h>
#include <math.h>

void main()
{
	int t,i,compare1,compare2,sign=0;
	int king,queen,car,elephant;
	cin>>t;
	char (*pt)[2][3] = new char [t][2][3];

	for(i=0;i<t;i++)
	{
		cin>>pt[i][0]>>pt[i][1];

		if( (pt[i][0][0]==pt[i][1][0]) && (pt[i][0][1]==pt[i][1][1]) )
		{
			cout<<0<<' '<<0<<' '<<0<<' '<<0<<endl;
			continue;
		}
		
		compare1 = abs(pt[i][0][0]-pt[i][1][0]);
		compare2 = abs(pt[i][0][1]-pt[i][1][1]);
		if(compare1>=compare2)
		{
			king=compare1;
			cout<<king<<' ';
		}
		else
		{
			king=compare2;
			cout<<king<<' ';
		}

		if((pt[i][0][0]+pt[i][0][1]==pt[i][1][0]+pt[i][1][1]) || (pt[i][0][0]-pt[i][0][1]==pt[i][1][0]-pt[i][1][1]))
			sign=1;
		
		if((pt[i][0][0]==pt[i][1][0]) || (pt[i][0][1]==pt[i][1][1]))
		{
			queen=car=1;
			cout<<queen<<' '<<car<<' ';
		}
		else
		{
			if(sign)
			{
				queen=1;
				cout<<queen<<' ';
			}
			else
			{
				queen=2;
				cout<<queen<<' ';
			}
			car=2;
			cout<<car<<' ';
		}

		if(( (pt[i][0][0]+pt[i][0][1])%2) != ((pt[i][1][0]+pt[i][1][1])%2) )
			cout<<"Inf";
		else if(sign)
		{
			elephant=1;
			cout<<elephant;
		}
		else
		{
			elephant=2;
			cout<<elephant;
		}

		cout<<endl;
	}
	delete[]pt;
}

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