ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1197. Lonesome Knight

No subject
Posted by megalodon 4 Oct 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 (-)
Posted by Ivankov Dmitry 4 Oct 2005 00:18
Re: No subject
Posted by ICh(USU) 4 Oct 2005 00:25
From g6 knight can move to h8,h6,f8,f6,e7,e5 - so, six moves
Knight?!?!?!?!?!
Posted by megalodon 4 Oct 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?!?!?!?!?!
Posted by ICh(USU) 4 Oct 2005 02:19
I'm sorry instead of h6 is h4 and instead of f6 is f4
Re: Knight?!?!?!?!?!
Posted by megalodon 4 Oct 2005 17:36
Aha!
That's a different thing...
Ok...
Thanks...
Knight
Posted by megalodon 5 Oct 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???