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> int max ( int , int ); int main () { int t, i, a, b; char * sp1, *edp1; int *sp2, *edp2; int king, queen, vichle, eleph; cin >> t; sp1 = new char[t]; edp1 = new char[t]; sp2 = new int[t]; edp2 = new int[t]; for ( i = 0; i < t; i++ ){ cin >> sp1[i] >> sp2[i] >> edp1[i] >> edp2[i]; } for ( i = 0; i < t; i++ ){ a = abs(sp1[i] - edp1[i]); b = abs(sp2[i] - edp2[i]); if ( a == 0){ king = b; queen = vichle = 1; cout << king << " " << queen << " " << vichle << " " << "Inf\n"; } else if ( b == 0 ){ king = a; queen = vichle = 1; cout << king << " " << queen << " " << vichle << " " << "Inf\n"; } else if ( a == b ){ king = a; queen = eleph = 1; vichle = 2; cout << king << " " << queen << " " << vichle << " " << eleph << endl; } else { king = max(a, b); queen = vichle = eleph = 2; cout << king << " " << queen << " " << vichle << " " << eleph << endl; } } return 0 ; } int max ( int a, int b ) { if ( a > b ) return a; else return b; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator