Cod sursă (job #546195)

Utilizator avatar valentin2612 Foros Valentin valentin2612 IP ascuns
Problemă Fotografie (clasele 9-10) Compilator cpp | 0,54 kb
Rundă Arhiva de probleme Status evaluat
Dată 19 mar. 2020 15:53:59 Scor 40
#include <bits/stdc++.h>
using namespace std;

ifstream ci("fotografie.in");
ofstream co("fotografie.out");

int n, m, p, q, i, j, y, x;
char a[10000][10000], b[10000][10000];

void check() {
	for(i=0; i<p; i++)
		for(j=0; j<q; j++)
			if(a[y+i][x+j]!=b[i][j])
				return;
	co<<y<<' '<<x<<'\n';
}

int main() {
	ci>>n>>m;
	for(i=0; i<n; i++)
		for(j=0; j<m; j++)
			ci>>a[i][j];
	ci>>p>>q;
	for(i=0; i<p; i++)
		for(j=0; j<q; j++)
			ci>>b[i][j];
	for(y=0; y<n-p+1; y++)
		for(x=0; x<m-q+1; x++)
			check();
	return 0;
}