Cod sursa(job #639107)

Utilizator lorincziistiLorinczi Istvan lorincziisti Data 22 noiembrie 2011 15:16:50
Problema DreptPal Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.51 kb
#include<stdio.h>

int a[1001][1001],b[1001][1001],i,j,n,m,k,l,s;
FILE *f,*g;

int main()
{//f=fopen("dreptpal.in","r");
//g=fopen("dreptal.out","w");
freopen("dreptpal.in","r",stdin);
freopen("dreptpal.out","w",stdout);
scanf("%d%d",&n,&m);
for(i=0;i<n;i++)
for(j=0;j<m;j++)
	scanf("%d",&a[i][j]);

for(i=0;i<n;i++)
for(j=1;j<m-1;j++)
{k=1;
	while(a[i][j-k]==a[i][j+k]&&k<=j&&k<n-j) k++;
	b[i][j]=2*k-1;
}
for(i=0;i<n;i++)
{for(j=0;j<m;j++)
printf("%d ",b[i][j]);
printf("\n");
}
}