• Определить, может ли шахматный конь за один ход попасть из клетки с координатами (х1,у1) в клетку с координатами (х2,у2). (на Pascal)

Ответы 1

  • #include "stdafx.h"

    #include <iostream>

    #include <stdio.h>

    using namespace std;

    int main ()

     {

    short int x1,y1,x2,y2;

    cout << "Input x1: ";

    cin>> x1;

    cout<<endl<<"Input y1: ";

    cin>> y1;

    cout << "Input x2: ";

    cin>> x2;

    cout<<endl<<"Input y2: ";

    cin>> y2;

    if ((abs(x2-x1)!=1) || (abs(y2-y1) !=2))

    {cout<<"NOT";} else

    {cout<<"OK"<<endl;}

    system("PAUSE");

    return 0;

  • Добавить свой ответ

Еще вопросы

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years