| ||||||||||
| 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<math.h>
main()
{
char d1[2],d2[2];
int dx,dy,i,n;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%s %s",&d1[2],&d2[2]);
dx=abs(d1[0]-d2[0]);dy=abs(d1[1]-d2[1]);
if(dx==0&&dy==0) printf("0 0 0 0\n");
else if(dx==0||dy==0)
{
if(dx%2==0) printf("%d 1 1 2\n",dy);
else printf("%d 1 1 Inf\n",dy);
}
else
{
if(dx==dy) printf("%d 1 1 1\n",dy);
else if(dy%2==0) printf("%d 2 2 Inf\n",dy);
else printf("%d 2 2 2\n",dy);
}
}
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator