2019-04-26 00:59:26 C++

C++

Copy Copied! Full
#include <iostream> using namespace std; int check(int x,int y,vector<string> &data1,vector<string> &data2){ vector<string> A = data1; vector<string> B = data2; for(i=0;i<M;i++){ for(j=0;j<M;j++){ if(A[x+i][j+y]!=B[i][j])return 0; } } return 1; } int main(void){ int N,M; cin >> N >> M; vector<string> A; vector<string> B; int i,j,flag; for(i=0;i<N;i++)cin >> A[i]; for(i=0;i<M;i++)cin >> B[i]; for(i=0;i<=(N-M);i++){ for(j=0;j<=(N-M);j++){ flag = check(i,j,A,B); if(flag==1){ cout << "Yes"; return 0; } } } cout << "No"; return 0; }
RECOMMEND