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 woaixiyuan at 2008-03-12 16:39:49 on Problem 1657

#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:
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