Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1.  
  2.  
  3. #include <iostream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int massive[9][9] =
  10. {
  11. // 0 1 2 3 4 5 6 7 8
  12. {0, 0, 0, 0, 0, 0, 0, 0, 2}, // 0
  13. {0, 0, 0, 0, 0, 0, 0, 2, 1}, // 1
  14. {0, 0, 0, 0, 0, 0, 2, 1, 2}, // 2
  15. {0, 0, 0, 0, 0, 2, 1, 2, 1}, // 3
  16. {0, 0, 0, 0, 2, 1, 2, 1, 2}, // 4
  17. {0, 0, 0, 2, 1, 2, 1, 2, 1}, // 5
  18. {0, 0, 2, 1, 2, 1, 2, 1, 2}, // 6
  19. {0, 2, 1, 2, 1, 2, 1, 2, 1}, // 7
  20. {2, 1, 2, 1, 2, 1, 2, 1, 2}, // 8
  21. };
  22. for(int i = 0; i <= 8; i++)
  23. {
  24. int k=0;
  25. for(int j = i, k=j; j >= 0; j--, k++)
  26. {
  27. if(i != j && k<=8)
  28. {
  29. massive[i][8-i] += massive[k][8-j];
  30. }
  31. }
  32. }
  33. for(int i = 0; i<9; i++)
  34. {
  35. for(int j = 0; j<9; j++)
  36. cout<<massive[i][j]<<" ";
  37. cout<<endl;
  38. }
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement