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

Re:为什么老是wa,测试时是对的啊!??求高手指正

Posted by kino_0 at 2012-03-06 19:53:47 on Problem 1657
In Reply To:为什么老是wa,测试时是对的啊!??求高手指正 Posted by:19920719 at 2011-07-18 21:06:19
> #include <stdio.h>
> #include <math.h>
> main()
> {
>     int i,j,n,w,x,y;
>     char a[5],b[5];
>     scanf("%d",&n);    
>     while(n)
>     {  
>         scanf("%s%s",a,b);
>         	x=fabs(b[0]-a[0]);
>         	y=fabs(b[1]-a[1]);
>         if(x==y&&x==0&&y==0)
>         printf("0 0 0 0\n");
>         else if(x==y&&x!=0&&y!=0)
>         {
> 	    printf("%d 1 2 1\n",x);	
>         }	    
>         else if(x==0&&y!=0)
>         printf("%d 1 1 Inf\n",y);
>         else if(y==0&&x!=0)
>         printf("%d 1 1 Inf\n",x);
>         else if(x!=0&&y!=0&&x!=y)
>         {
>       	 if(x>y)
>         w=x;                                                                                                                                                                                                        
>         else
>         w=y; 
>         printf("%d 2 2 Inf\n",w);
>         }
>         n--;     
>         } 		
>     }

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