11040 - Add bricks in the wall
Posted: Sat Jul 08, 2006 11:05 am
who can check my code?
i dont know why?
i use gcc compile it on my computer ,and it works well...
i dont know why?
i use gcc compile it on my computer ,and it works well...
Code: Select all
#include <stdio.h>
int main()
{
int wall[9][9];
int cases;
scanf("%d",&cases);
int row,col;
while(cases-->0)
{
for(row=0;row<=8;row+=2)
{
for(col=0;col<=row;col+=2)
{
scanf("%d",&(wall[row][col]));
}
}
for(row=0;row<=6;row+=2)
{
for(col=0;col<=row;col+=2)
{
wall[row+2][col+1]=(wall[row][col]-wall[row+2][col]-wall[row+2][col+2])/2;
wall[row+1][col]=wall[row+2][col]+wall[row+2][col+1];
wall[row+1][col+1]=wall[row+2][col+2]+wall[row+2][col+1];
}
}
for(row=0;row<=8;row++)
{
for(col=0;col<=row;col++)
{
printf("%d ",wall[row][col]);
}
printf("\n");
}
}
return 0;
}