zoukankan      html  css  js  c++  java
  • poj1657

    简单题

    View Code
    #include <iostream>
    #include
    <cstdio>
    #include
    <cstdlib>
    #include
    <cstring>
    #include
    <cmath>
    using namespace std;

    int main()
    {
    //freopen("t.txt", "r", stdin);
    int t;
    scanf(
    "%d", &t);
    getchar();
    while (t--)
    {
    int x1 = getchar() - 'a' + 1;
    int y1 = getchar() - '0';
    getchar();
    int x2 = getchar() - 'a' + 1;
    int y2 = getchar() - '0';
    int x = abs(x1 - x2);
    int y = abs(y1 - y2);
    getchar();
    if (x == 0 && y == 0)
    {
    printf(
    "0 0 0 0\n");
    continue;
    }

    printf(
    "%d ", max(x, y));

    if (x == y || x == 0 || y == 0)
    printf(
    "1 ");
    else
    printf(
    "2 ");

    if (x == 0 || y == 0)
    printf(
    "1 ");
    else
    printf(
    "2 ");

    if ((x + y) & 1)
    printf(
    "Inf\n");
    else if (x == y)
    printf(
    "1\n");
    else
    printf(
    "2\n");
    }
    return 0;
    }

  • 相关阅读:
    Web开发快速上手
    前端概述
    Python语言进阶
    图像和办公文档处理
    网络编程
    进程和线程
    正则表达式
    面向对象进阶
    面向对象
    js 获取指定时间上月26 ,
  • 原文地址:https://www.cnblogs.com/rainydays/p/2082555.html
Copyright © 2011-2022 走看看