Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int massive[9][9] =
- {
- // 0 1 2 3 4 5 6 7 8
- {0, 0, 0, 0, 0, 0, 0, 0, 2}, // 0
- {0, 0, 0, 0, 0, 0, 0, 2, 1}, // 1
- {0, 0, 0, 0, 0, 0, 2, 1, 2}, // 2
- {0, 0, 0, 0, 0, 2, 1, 2, 1}, // 3
- {0, 0, 0, 0, 2, 1, 2, 1, 2}, // 4
- {0, 0, 0, 2, 1, 2, 1, 2, 1}, // 5
- {0, 0, 2, 1, 2, 1, 2, 1, 2}, // 6
- {0, 2, 1, 2, 1, 2, 1, 2, 1}, // 7
- {2, 1, 2, 1, 2, 1, 2, 1, 2}, // 8
- };
- for(int i = 0; i <= 8; i++)
- {
- int k=0;
- for(int j = i, k=j; j >= 0; j--, k++)
- {
- if(i != j && k<=8)
- {
- massive[i][8-i] += massive[k][8-j];
- }
- }
- }
- for(int i = 0; i<9; i++)
- {
- for(int j = 0; j<9; j++)
- cout<<massive[i][j]<<" ";
- cout<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement