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 AWR at 2009-03-06 22:33:33 on Problem 1657
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
    int x,y,t,i,w,h,c,xh;
    char a[5]={0},b[5]={0};
    scanf("%d",&t);
    for(i=0;i<t;i++)
    {
                    scanf("%s%s",&a,&b);
                    x=abs(b[0]-a[0]);
                    y=abs(b[1]-a[1]);
                    if(x==0&&y==0){printf("0 0 0 0\n");continue;}
                    w=x>=y?x:y;
                    if(x==y||x==0||y==0)h=1;
                    else h=2;
                    if(x==0||y==0)c=1;
                    else c=2;
                    if(x==y) xh=1;
                    else if(abs(x-y)%2==0)xh=2;
                         else {printf("%d %d %d Inf\n",w,h,c);continue;}
                    printf("%d %d %d %d\n",w,h,c,xh);
    }
                    system("pause");
                    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