fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. const int MAX_SIZE = 10;
  5.  
  6. int main() {
  7. int size, linePos, colPos, mt[MAX_SIZE +1][MAX_SIZE + 1];
  8. cin >> size >> linePos >> colPos;
  9. for (int line = 1; line <= size; ++line) {
  10. for (int col = 1; col <= size; ++col) {
  11. cin >> mt[line][col];
  12. }
  13. if (1 <= line - linePos + colPos && line - linePos + colPos <= size) {
  14. cout << mt[line][line - linePos + colPos] << " ";
  15. }
  16. }
  17. return 0;
  18. }
Success #stdin #stdout 0.01s 5272KB
stdin
3 3 3
1 2 3
4 5 6
7 8 9
	 
1 5 9
stdout
1 5 9