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

自己调试结果正确,怎么提交老师wrong

Posted by huacuilaifa at 2012-03-16 21:15:25 on Problem 1657
求指教
#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:
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