fork download
  1. program ideone;
  2.  
  3. Type simple = array[1..20, 1..20] of shortint;
  4. var arr:simple; m, n, k, i, j: shortint;
  5.  
  6. begin
  7. readln(m, n);
  8. for i:=1 to m do
  9. for j:=1 to n do
  10. read(arr[i, j]);
  11. readln();
  12. read(k);
  13.  
  14. for i:=1 to m do begin
  15. for j:=n-k+1 to n do write(arr[i, j], ' ');
  16. writeln(); end;
  17.  
  18. for i:=1 to m do begin
  19. for j:=1 to k do write(arr[i, j], ' ');
  20. writeln(); end;
  21. end.
Success #stdin #stdout 0s 5280KB
stdin
5 5
7 9 1 5 2
5 8 1 0 10
3 2 5 5 6
5 4 1 8 0
13 4 9 5 9
2
stdout
5 2 
0 10 
5 6 
8 0 
5 9 
7 9 
5 8 
3 2 
5 4 
13 4