# Problemas programacion

Solo disponible en BuenasTareas
• Páginas : 2 (434 palabras )
• Descarga(s) : 7
• Publicado : 10 de mayo de 2010

Vista previa del texto
2025 - Digital Lab
Latin America - Mexico and Central America - 2000/2001

Assume that you work for the Digital Processing Lab. They ask you to write a program withan input binary matrix A, which contains the pattern to search on other binary matrix B. The input file include the size and elements for both A and B. The recognitionprocess consists in scanning row by row (horizontal scanning) the matrix B, when a pattern is located on B you must mark this pattern. To mark a located pattern change 1to 2 and 0 to * on B. The output file of your program will be the matrix B with the located patterns marked.

Input
The first line of the input contains the number oftest. For each test, the first line contains the size of A, next lines contains the matrix A row by row, next line contains the size of B and next lines contains thematrix B row by row. Each test will be separated by exactly one empty line.

Output
For every test, the output is the matrix B with the located patterns marked. Outputone empty line between test.

Sample Input
4 2 1 1 5 1 0 1 1 0 1 1 5 1 0 1 1 0 1 0 5 1 0 1 1 0 2 0 1 5 1 1 0 1 0 1 5 1 1 0 1 0 1 5 1 1 0 1 0

0 1 0 1 1

0 0 1 1 10 0 0 0 1

0 1 0 1 1

0 0 1 1 1

0 0 0 0 1

0 1 0 1 1

0 0 1 1 1

0 0 0 0 1

2 6 1 0 0 1 0 1 1 1 1 0 1 0
2025 - Digital Lab 1/2

5 1 0 1 1 0

5 11 0 1 0

0 1 0 1 1

0 0 1 1 1

0 0 0 0 1

Sample Output
1 0 2 2 0 2 0 2 2 0 1 * 1 1 * 1 0 1 1 0 2 2 * 2 0 2 2 0 2 0 1 1 * 1 * 1 1 0 1 0 * 2 0 1 1 0 2 0 2 2 * 1* 1 1 0 1 0 1 1 0 0 1 2 2 0 0 2 2 2 * * 1 1 1 0 0 1 1 1 0 0 0 * 2 0 0 0 0 2 * * * * 1 0 0 0 0 1

Mexico and Central America 2000-2001

2025 - Digital Lab

2/2