| ||||||||||
| 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 | |||||||||
个人通过代码、给后来的人参考。#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int x,y,t,i,w,h,c,xh;
char a[5]={0},b[5]={0};
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%s%s",&a,&b);
x=abs(b[0]-a[0]);
y=abs(b[1]-a[1]);
if(x==0&&y==0){printf("0 0 0 0\n");continue;}
w=x>=y?x:y;
if(x==y||x==0||y==0)h=1;
else h=2;
if(x==0||y==0)c=1;
else c=2;
if(x==y) xh=1;
else if(abs(x-y)%2==0)xh=2;
else {printf("%d %d %d Inf\n",w,h,c);continue;}
printf("%d %d %d %d\n",w,h,c,xh);
}
system("pause");
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator