ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1197. Один в поле воин

No subject
Послано megalodon 4 окт 2005 00:09
Anyone here knows how to play chess?
For g6 it is NOT 6, it IS 4!
you are wrong, sample is correct (-)
Послано Ivankov Dmitry 4 окт 2005 00:18
Re: No subject
Послано ICh(USU) 4 окт 2005 00:25
From g6 knight can move to h8,h6,f8,f6,e7,e5 - so, six moves
Knight?!?!?!?!?!
Послано megalodon 4 окт 2005 00:50
You guys are mocking me...

We are talking about a KNIGHT!
How can a KNIGHT(!) from g6 can move to h6?!?!?!?!?!


Edited by author 04.10.2005 01:11
Re: Knight?!?!?!?!?!
Послано ICh(USU) 4 окт 2005 02:19
I'm sorry instead of h6 is h4 and instead of f6 is f4
Re: Knight?!?!?!?!?!
Послано megalodon 4 окт 2005 17:36
Aha!
That's a different thing...
Ok...
Thanks...
Knight
Послано megalodon 5 окт 2005 20:53
Um...Yes, they are 6 moves...
But I still have a problem with #test2

Here is my prgram:

#include<iostream.h>
int the_board[16][16];
char place[2];
int i, j, counter, N, k, l;

void enter()
{

 cin>>place;
  i = place[1] - '0';
  k = i-1;

    if ( place[0] == 'a' ) j = 1;
    if ( place[0] == 'b' ) j = 2;
    if ( place[0] == 'c' ) j = 3;
    if ( place[0] == 'd' ) j = 4;
    if ( place[0] == 'e' ) j = 5;
    if ( place[0] == 'f' ) j = 6;
    if ( place[0] == 'g' ) j = 7;
    if ( place[0] == 'h' ) j = 8;

    l = j-1;
}


void calculate()
{
    for( i = 0;i < 14;i++ )
     for( j = 0;j < 14;j++ )
     the_board[i][j] = 0;


    the_board[k][l] = 1;
    the_board[k-2][l-1] = 2;
    the_board[k-2][l+1] = 2;
    the_board[k+2][l+1] = 2;
    the_board[k+2][l-1] = 2;
    the_board[k+1][l+2] = 2;
    the_board[k-1][l+2] = 2;
    the_board[k+1][l-2] = 2;
    the_board[k-1][l-2] = 2;

      for( i = 0;i < 8;i++ )
       for( j = 0;j < 8;j++ )
        if ( the_board[i][j] == 2 ) counter++;
}


void main()
{

 int re_counter[100];
  for( int h = 0;h < 100;h++ )
   re_counter[h] = 0;


 cin>>N;
  for( int i = 0;i < N;i++ )
   {
    enter();
    calculate();

     if ( re_counter[i] == 0 )
      re_counter[i] = counter;
      counter = 0;

   }

   for( i = 0;i < N;i++ )
    cout<<re_counter[i]<<endl;

}

What is wrong with it???