fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n, m, coordA, coordB;
  6. cin >> n >> m >> coordA >> coordB;
  7. int index = 1;
  8. for (int i = 1; i <= n; ++i) {
  9. int firstVal = coordA + coordB ;
  10. if (i <= coordA) {
  11. firstVal -= i;
  12. } else {
  13. firstVal = firstVal - coordA + index;
  14. ++index;
  15. }
  16. for (int j = 1; j <= m; ++j) {
  17. if (j <= coordB) {
  18. --firstVal;
  19. cout << firstVal <<" ";
  20.  
  21. } else {
  22. ++firstVal;
  23. cout << firstVal <<" ";
  24. }
  25. }
  26. cout << "\n";
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5284KB
stdin
5 4 
3 1 
stdout
2 3 4 5 
1 2 3 4 
0 1 2 3 
1 2 3 4 
2 3 4 5