Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:为什么老是wa,测试时是对的啊!??求高手指正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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator