Advertisement
a53

zoom

a53
Sep 17th, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4. ifstream cin("zoom.in");
  5. ofstream cout("zoom.out");
  6. short int p,m,n,a[1000][1000],b[10][10];
  7. long int c;
  8.  
  9. int caut_b_in_a(int i,int j)
  10. {
  11. for(int x=0;x<p;x++)
  12. for(int y=0;y<p;y++)
  13. {
  14. if(b[x][y]!=a[i+x][j+y])
  15. return 0;
  16. }
  17. return 1;
  18. }
  19.  
  20. int main()
  21. {
  22. cin>>p>>m>>n;
  23. for(int i=0;i<p;i++)
  24. for(int j=0;j<p;j++)
  25. cin>>b[i][j];
  26. for(int i=0;i<m;i++)
  27. for(int j=0;j<n;j++)
  28. cin>>a[i][j];
  29. for(int i=0;i<m-p+1;i++)
  30. for(int j=0;j<n-p+1;j++)
  31. c+=caut_b_in_a(i,j);
  32. cout<<c;
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement