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

各位同学请帮我看一下,什么地方出了问题

Posted by apolor at 2004-05-15 14:47:34 on Problem 1657
#include<iostream.h>
#include<math.h>

void main(){
	char x[20][8],y[20][8];
	int n,i,ax,ay;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>x[i]>>y[i];
	for(i=0;i<n;i++){
		ax=abs(x[i][0]-y[i][0]);
		ay=abs(x[i][1]-y[i][1]);
		if(ax>ay)
			cout<<ax<<" ";
		else cout<<ay<<" ";

		if(ax==ay||ax==0||ay==0)
			cout<<"1 ";
		else cout<<abs(ax-ay)+1<<" ";

		if(ax==0||ay==0)
			cout<<"1 ";
		else cout<<"2 ";
		
		if(ax==ay) 
			cout<<"1 "<<endl;
		else cout<<"Inf "<<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