Advertisement
marativ

Untitled

Nov 13th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int a[1001][1001];
  4. int main ()
  5. {
  6. int n,m,b,r,s,i,j,k,l,nr=0,js=0,dr=0;
  7. cin>>n;
  8. for(i=1; i<=n; i++)
  9. {
  10. for(j=1; j<=n; j++)
  11. {
  12. cin>>a[i][j];
  13. }
  14. }
  15. for(i=1; i<=n; i++)
  16. {
  17. for(j=1; j<=n; j++)
  18. {
  19. if(i+j==n)
  20. {
  21. if(a[i][j]==a[i+1][j-1])
  22. {
  23. nr++;
  24. }
  25. }
  26. }
  27. }
  28. for(i=1; i<=n; i++)
  29. {
  30. for(j=1; j<=n; j++)
  31. {
  32.  
  33. if(a[i][j]==a[i][j+1])
  34. {
  35. dr++;
  36. }
  37. }
  38.  
  39. }
  40. for(i=1; i<=n; i++)
  41. {
  42. for(j=1; j<=n; j++)
  43. {
  44. if(a[i][j]==a[i+1][j])
  45. {
  46. js++;
  47. }
  48. }
  49. }
  50. cout<<nr<<" "<<dr<<" "<<js;
  51. }
  52. 2-ullllll ll
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement