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 1377. Lara Croft

--AESC USU-- Куделевский Женя Why Compilation Error ???????????????????? [2] // Problem 1377. Lara Croft 19 Sep 2005 15:39
int pole[100][100];

int main()
{
    int mx1,my1,mx2,my2,l,flag;
      l=0;
      flag= 0;

    int n,m;
    scanf("%d %d",&m,&n);
    scanf("%d %d",&mx1,&my1);
    scanf("%d %d",&mx2,&my2);
    pole[mx1][my1] = pole[mx2][my2] = 2;

    int i;
    for(i=0;i<=n+1;i++)
    {
        pole[0][i] = pole[m+1][i] = 1;
    }
    for(i=0;i<=m+1;i++)
    {
        pole[i][0] = pole[i][n+1] = 1;
    }

    int x=1,y=1,dx=0,dy=1;
    if(pole[x][y]==2) flag = 1;
    pole[x][y] = 1;
    while(1)
    {
        if(pole[x+dx][y+dy]!=1)
        {
            x+=dx; y+=dy;
            if(pole[x][y]==2)
            {
                if(flag) { printf("%d",l+1); return(0); }
                else { flag = 1; l=0; }
            }
            else l++;
            pole[x][y] = 1;
        }
        else
        {
            if(dy==1) { dy=0; dx=1; }
            else if(dx==1) { dx=0; dy=-1; }
            else if(dy==-1) { dy=0; dx=-1; }
            else if(dx==-1) { dx=0; dy=1; }
        }
    }
    return(0);
}
Ivankov Dmitry Re: Why Compilation Error ???????????????????? // Problem 1377. Lara Croft 19 Sep 2005 19:55
#include <stdio.h>
Ivankov Dmitry Add #include <stdio.h> // Problem 1377. Lara Croft 19 Sep 2005 19:56
Add #include <stdio.h>