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 |
自己调试结果正确,怎么提交老师wrong求指教 #include <stdio.h> #include <math.h> int main() { int nCases; int i,x,y; char begin[5],end[5]; scanf("%d",&nCases); for(i=0;i<nCases;i++){ scanf("%s%s",begin,end); 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) != 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