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 cpp0600548137 at 2006-02-26 21:35:46 on Problem 1657
#include<iostream.h>
void main()
{
	char reduce[2][3];
	int i=0,times;
	cin>>times;
	for(i=0;i<times;i++)
	{   cin>>reduce[0]>>reduce[1];

	int  res1,res2;
	res1=reduce[0][0]-reduce[1][0];
	res2=reduce[0][1]-reduce[1][1];

	int s1,s2,a,b,c,d;

	
	s1=res1>0?res1:-res1;
	s2=res2>0?res2:-res2;

	a= s1>s2?s1:s2;
	b= (s1*s2==0||s1-s2==0)?1:2;
	c= (s1*s2==0)?1:2;
	d= (s1==s2)?1:((s1-s2)%2==0?2:0);

	if(d==0)
		cout<<a<<" "<<b<<" "<<c<<" "<<"Inf"<<endl;
	else
		cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;
	}
}

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