| ||||||||||
| 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 | |||||||||
Re:思路是对的,怎么就是老给我“wrong answer”呢? 高人给看看吧!In Reply To:思路是对的,怎么就是老给我“wrong answer”呢? 高人给看看吧! Posted by:cpp0600548137 at 2006-02-26 21:35:46 #include<iostream>
using namespace std;
int mm(int, int);
int main()
{
int times, d1, d2;
char a[3], b[3];
cin >> times;
for (int i = 1; i <= times; i ++)
{
cin >> a >> b;
d1 = mm (int(a[0]) , int(b[0]));
d2 = mm (int(a[1]) , int(b[1]));
if (d1 == 0 && d2 == 0)
cout << 0 << ' ' << 0 << ' ' << 0 << ' ' << 0 << endl;
else
{
cout << (d1 > d2 ? d1 : d2) << ' ';
if (d1 == d2 || d1 == 0 || d2 == 0)
cout << 1 << ' ';
else
cout << 2 << ' ';
if (d1 == 0 || d2 == 0)
cout << 1 << ' ';
else
cout << 2 << ' ';
if (d1 == d2 && d1 != 0)
cout << 1 ;
else if (mm(d1 , d2) % 2 == 0)
cout << 2;
else
cout << "Inf";
cout << endl;
}
}
}
int mm(int a, int b)
{
if (a > b)
return a - b;
else
return b - a;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator