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 |
兄弟,帮帮忙#include<stdio.h> #include<iostream.h> #include<math.h> int main() { int n,dx,dy;char d1[2],d2[2]; scanf("%d",&n); while(n--) { cin>>d1>>d2; dx=abs(d1[0]-d2[0]); dy=abs(d1[1]-d2[1]); if((dx==0)&&(dy==0)) cout<<"0 0 0 0"<<endl; else { if(dx>dy) cout<<dx<<" "; else cout<<dy<<" "; if(dx==0||dy==0||dx==dy) cout<<"1 "; else cout<<"2 "; if(dx==0||dy==0) cout<<"1 "; else cout<<"2 "; if((abs(dx-dy))%2==1||(dx%2==1&&dy%2==0)) cout<<"Inf"<<endl; else if(dx==dy) cout<<"1"<<endl; else cout<<"2"<<endl; } }; return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator