poj1657

//

//  main.cpp

//  1657

//

//  Created by Jasmine wang on 05/11/2017.

//  Copyright © 2017 Jasmine wang. All rights reserved.

//


#include <iostream>

#include <cmath>

using namespace std;

int main(int argc, const char * argv[]) {

    int t;

    cin >> t;

    while(t --){

        char begin[5], end[5];

        cin >> begin >> end;

        int x, y;

        x = abs(begin[0] - end[0]);

        y = abs(begin[1] - end[1]);

        if(x == 0 && y == 0){

            cout << "0 0 0 0" << endl;

        }

        else{

            if(x < y){

                printf("%d ", y);

            }

            else printf("%d ", x);

            if(x == y || x == 0 || y == 0){

            cout << "1 ";

            }

            else cout << "2 ";

            if(x == 0 || y == 0){

                cout << "1 ";

            }

            else cout << "2 ";

            if(abs(x - y)%2 != 0){

                cout << "Inf " << endl;

            }

            else if(x == y){

                cout << "1 " << endl;

            }

            else cout << "2 "<< endl;

        }

    }

    

    return 0;

}


猜你喜欢

转载自blog.csdn.net/Jazzmine/article/details/78453209
今日推荐