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 |
各位高手,帮我看一下我的程序,我都快运了,怎么总是wrong answer 呀?在下感激不尽呀。#include <iostream.h> #include <math.h> #include <iomanip.h> void main() { int t,i; int w,x,y,z; char k[21],m[21]; int j[21],n[21]; cin>>t; for(i=1;i<=t;i++) { cin>>k[i]>>j[i]>>m[i]>>n[i]; } for(i=1;i<=t;i++) { { if(k[i]==m[i]||j[i]==n[i]||abs (m[i]-k[i])==abs(n[i]-j[i])) x=1; else x=2; } { if (k[i]==m[i]||j[i]==n[i]) y=1; else y=2; } { if(abs (m[i]-k[i])>=abs(n[i]-j[i])) w=abs(m[i]-k[i]); else w=abs(n[i]-j[i]); } { if(abs (m[i]-k[i])==abs(n[i]-j[i])) { z=1; cout<<w<<setw(4)<<x<<setw(4)<<y<<setw(4)<<z<<endl; } else { if(abs(('m[i]'-'a'+n[i])-('k[i]'-'a'+j[i]))%2==0) { z=2; cout<<w<<setw(4)<<x<<setw(4)<<y<<setw(4)<<z<<endl; } else cout<<w<<setw(4)<<x<<setw(4)<<y<<setw(6)<<"inf"<<endl; } } } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator