poj1657

来源:互联网 发布:股票实时数据 大智慧 编辑:程序博客网 时间:2024/06/05 04:34

//

//  main.cpp

//  1657

//

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

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

//


#include <iostream>

#include <cmath>

using namespacestd;

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);

            }

            elseprintf("%d ", x);

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

            cout <<"1 ";

            }

            elsecout << "2 ";

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

                cout <<"1 ";

            }

            elsecout << "2 ";

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

                cout <<"Inf " << endl;

            }

            elseif(x == y){

                cout <<"1 " << endl;

            }

            elsecout << "2 "<<endl;

        }

    }

    

    return0;

}


原创粉丝点击