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

我的程序的怪事,求指导

Posted by Lyshen at 2011-02-09 18:28:09 on Problem 1657
#include<stdio.h>
#include<stdlib.h>
int main()
{int i,t,Xx,Xy,Yx,Yy;
 char Xchar,Ychar;
 scanf("%d",&t);
 for(i=1;i<=t;i++)
  {scanf("%c%d %c%d",&Xchar,&Xy,&Ychar,&Yy);
   Xx='i'-Xchar;    Yx='i'-Ychar;
   if ((Xx==Yx)&&(Xy==Yy)) {printf("0 0 0 0\n");}
                     else  { int absx=abs(Xx-Yx);
                             int absy=abs(Xy-Yy);
                             //王的步数 
                               if (absx>absy) {printf("%d ",absx);}
                                                    else  {printf("%d ",absy);}
                             //后的步数 
                               if ( (Xx==Yx)||(Xy==Yy)||(absx==absy) ) {printf("1 ");}
                                                    else   {printf("2 ");} 
                             //车的步数 
                               if ((Xx==Yx)||(Xy==Yy)) {printf("1 ");}
                                                    else  {printf("2 ");}
                             //象的步数 
                               if  ((Xx+Xy)%2!=(Yx+Yy)%2) {printf("Inf\n");}
                                                    else    {if (absx==absy) {printf("1\n");}
                                                                      else   {printf("2\n");}
                                                            }
                            } 
   }
return 0;
}



令我抓狂的是:我的程序输入样例后
My Input

2
a1 c3
f5 f8
My Output
79693342 2 2 2(不知道从哪里来的!!)
2 1 2 1(答案正确)
92 2 2 2(不知道从哪里来的!!!	)
3 1 1 Inf (答案正确)

请高手们指教一下

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