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 |
坚决要求Online Judge把测试数据和测试结果给出来In Reply To:汗,又打错了一个字母,WAWAWAWAWA无语了 Posted by:054100526 at 2008-04-27 20:35:02 #include<iostream> using namespace std; int main() { int n; cin>>n; for(int i=0;i<n;i++) { char ch[2]; int x[2],y[2]; for(int j=0;j<2;j++) { cin>>ch; x[j]=int(ch[1]-'0'); y[j]=int (ch[0]-'a'); } bool InLine=false,OnCross=false; if(x[1]==x[0]||y[1]==y[0]) //是否在同一行列 InLine=true; if((x[0]-x[1]==y[0]-y[1]) //是否在同一对角线 ||x[1]+y[1]==x[0]+y[0]) OnCross=true; int a,b,c,d; //King int dx=x[1]>x[0]?x[1]-x[0]:x[0]-x[1]; int dy=y[1]>y[0]?y[1]-y[0]:y[0]-y[1]; a=dx>dy?dx:dy; //Queen b=InLine||OnCross?1:2; //vehicle c=InLine?1:2; //elephant if(OnCross) d=1; else if((x[1]+y[1])%2==(x[0]+y[0])%2) d=2; else d=0; if(d==0) cout<<a<<" "<<b<<" "<<c<<" Inf"<<endl; else cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl; } return 0; } 不知多少遍 还是Wrong Answer Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator