| ||||||||||
| 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 | |||||||||
为什么经常compile error?明明在自己机子上没问题代码:请帮忙看一下
#include"stdio.h"
#include"math.h"
int main()
{ int nCases,i;
while(scanf("%d",&nCases)){
for(i=0;i<nCases;i++){
char begin[5],end[5];
scanf("%s%s",begin,end);
int x,y;
x=abs(begin[0]-end[0]);
y=abs(begin[1]-end[1]);
if(x==0&&y==0)printf("0 0 0 0\n");
else{
if(x<y)
printf(" %d",y);
else
printf(" %d",x); //王的步数
if(x==y||x==0||y==0)
printf(" 1");
else
printf(" 2"); //后的步数
if(x==0||y==0)
printf(" 1");
else
printf(" 2"); //车的步数
if(abs(x-y)%2!=0)
printf(" Inf\n");
else if(x==y)
printf(" 1\n");
else
printf(" 2\n"); //象的步数
}
}
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator