Poj Solution 2579

http://poj.org/problem?id=2579

#include"stdio.h"

char map[10][10];

int main()
{
    int i, j, m, n;

    scanf( "%*s" );
    while( scanf( "%d %d", &n, &m ) == 2 )
    {
        for( i=0; i<n; i++ )
            scanf( "%s", &map[i] );
        
        for( i=0; i<n-1; i++ )
        {
            for( j=0; j<m-1; j++ )
                printf( "%d", ( (int)map[i][j] + map[i+1][j] + map[i][j+1] + map[i+1][j+1] - (int)'0'*4 ) / 4 );

            printf( "n" );
        }
        
        scanf( "%*s" );
        scanf( "%*s" );
    }

    return 0;
}
											
This entry was posted in poj. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *