fork download
  1. #include <stdio.h>
  2.  
  3. int mat[1000][1000];
  4.  
  5. int main() {
  6. int m, n, i, j;
  7.  
  8. if (scanf("%d %d", &m, &n) != 2) return 0;
  9.  
  10. for (i = 0; i < m; i++) {
  11. for (j = 0; j < n; j++) {
  12. scanf("%d", &mat[i][j]);
  13. }
  14. }
  15.  
  16. for (i = m - 1; i >= 0; i--) {
  17. for (j = 0; j < n; j++) {
  18. printf("%d", mat[i][j]);
  19. if (j < n - 1) {
  20. printf(" ");
  21. }
  22. }
  23. printf("\n");
  24. }
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5316KB
stdin
4 5
1 0 8 6 1 
0 0 0 0 2 
0 0 0 3 3 
4 5 1 2 4
stdout
4 5 1 2 4
0 0 0 3 3
0 0 0 0 2
1 0 8 6 1