Cod sursa(job #270624)

Utilizator shnakoVlad Schnakovszki shnako Data 4 martie 2009 12:11:27
Problema Rj Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.63 kb
#include <stdio.h>
FILE *f, *g;
int dl[5]={0, -1, 0, 1,  0};
int dc[5]={0,  0, 1, 0, -1};
int m=0, n, v[100][100], x, y, xx, yy, i, j, t[100][100];
char t;
void back(int l, c, pas)
	{

int main(void)
{
f=fopen("rj.in", "r");
g=fopen("rj.out", "w");
fscanf(f, "%d%d", &n, &m);
fscanf(f, "%c", &t);
for (i=1;i<=n;i++)
	{
	for (j=1;j<=m;j++)
		{
		fscanf(f, "%c", &t);
		if (t==' ')
			v[i][j]=0;
		if (t=='X')
			v[i][j]=1;
		if (t=='R')
			{
			x=i;
			y=j;
			v[i][j]=2;
			}
		if (t=='J')
			{
			xx=i;
			yy=j;
			v[i][j]=3;
			}
		}
	fscanf(f, "%c", &t);
	}
t[x][y]=1;
back(x, y, 2);
return 0;
}