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;
}
- poj1657
- poj1657
- POJ1657-Distance on Chessboard
- POJ1657--Distance on Chessboard
- poj1657——Distance on Chessboard
- poj1657——Distance on Chessboard
- 2.2poj1657棋盘上的距离
- poj1657——Distance on Chessboard——简单题
- poj1657-Distance on Chessboard(棋盘上的距离)-C语言-简单计算
- Rabbitmq的使用及Web监控工具使用
- 使用七牛接口实现图片和文件一键上传
- 进程同步之信号量
- jmeter 函数及属性的获取方法
- 求组合数
- poj1657
- HDPCD-Java --- Exam Test
- 回忆自己曾经敲代码是不是是在敲代码
- Hadoop安装部署
- AbstractQueuedSynchronizer(AQS)
- pat乙级:第三题
- Activity生命周期
- 加密算法在Java
- 离线赛小技巧和提示以及做题流程