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 |
【总是error,我虚脱了……HELP!】#include <iostream.h> #include <math.h> void main(){ int nSum; int nRole[20][4]={0,}; char cLoc1x[20], cLoc2x[20], cLoc1y[20], cLoc2y[20]; cin>>nSum; int i; for(i=0; i<nSum; i++) { cin>>cLoc1x[i]>>cLoc1y[i]; cin>>cLoc2x[i]>>cLoc2y[i]; } for(i=0; i<nSum; i++) { int m=abs((int)cLoc1x[i]-(int)cLoc2x[i]),n=abs((int)cLoc1y[i]-(int)cLoc2y[i]); nRole[i][0]=(m>n)?m:n; nRole[i][1]=((m==n)||(m==0)||(n==0))?1:2; nRole[i][2]=((m==0)||(n==0))?1:2; nRole[i][3]=((m%2)==(n%2))?((m==n)?1:2):(-1); } for(i=0; i<nSum; i++) { cout<<nRole[i][0]<<" "<<nRole[i][1]<<" "<<nRole[i][2]<<" "; if(nRole[i][3]!=-1) cout<<nRole[i][3]<<" "<<endl; else cout<<"Inf "<<endl; } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator