Advertisement
a53

simetric

a53
Aug 29th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #include <cstdio>
  2. int n,m,i,j,lg,ok,nr;
  3. int v[403][403];
  4. int x[403][403];
  5.  
  6. int main()
  7. {
  8. freopen("simetric.in","r",stdin);
  9. freopen("simetric.out","w",stdout);
  10. scanf("%d%d",&n,&m);
  11. for(i=1;i<=n;++i)
  12. for(j=1;j<=m;++j)
  13. {
  14. scanf("%d",&v[i][j]);
  15. x[i][j]=1;
  16. }
  17. printf("%d\n",n*m);
  18. ok=1,lg=1;
  19.  
  20. while(ok)
  21. {
  22. ++lg;
  23. nr=0;
  24. for(i=1;i<=n-lg+1;++i)
  25. for(j=1;j<=m-lg+1;++j)
  26. {
  27. if(x[i][j] && x[i+1][j+1] && (v[i][j+lg-1]==v[i+lg-1][j]))
  28. ++nr;
  29. else
  30. x[i][j]=0;
  31. }
  32. if(!nr)
  33. ok=0;
  34. else
  35. printf("%d\n",nr);
  36. }
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement