fork(1) download
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int zwykle=0;
  8. int n=0;
  9. cin>>n;
  10. for(int f1=0;f1<n;f1++)
  11. {
  12. int x=0;
  13. int y=0;
  14. cin>>y>>x;
  15. char **tab = new char * [x]; //tworzenie tabeli
  16. for(int f3 = 0;f3<=y;f3++)
  17. {
  18. tab[f3]=new char[y];
  19. }
  20. for(int f4=0;f4<y;f4++) //wpisywanie
  21. {
  22. for(int f5=0;f5<x;f5++)
  23. {
  24. cin>>tab[f5][f4];
  25. }
  26. }
  27. if(zwykle==1) //zwykle
  28. {
  29. for(int f5=0;f5<y;f5++) //wypisywanie zwyk³e
  30. {
  31. for(int f6=0;f6<x;f6++)
  32. {
  33. cout<<tab[f6][f5]<<" ";
  34. }
  35. cout<<endl;
  36. }
  37. }
  38. cout<<endl; // wypisywanie
  39. int z;
  40. for(int f8=1;f8<x;f8++) //pierwsza linia
  41. {
  42. cout<<tab[f8][0]<<" ";
  43. z=f8;
  44. }
  45. cout<<tab[z][1]<<endl;
  46. for(int f9=1;f9<y-1;f9++) //ciało
  47. {
  48. int z1=0;
  49. cout<<tab[0][f9-1]<<" ";
  50. for(int fA=1;fA<x-1;fA++)
  51. {
  52. cout<<tab[fA][f9]<<" ";
  53. z1=fA+1;
  54. }
  55. cout<<tab[z1][f9+1];
  56. cout<<endl;
  57. }
  58. cout<<tab[0][y-2]<<" ";
  59. for(int fB=0;fB<x-1;fB++) //ostatnia linia
  60. {
  61. cout<<tab[fB][y-1]<<" ";
  62. }
  63.  
  64.  
  65. }
  66.  
  67. return 0;
  68. }
  69.  
Success #stdin #stdout 0s 15240KB
stdin
1
3 4
1 2 3 4 
6 7 8 9 
B C D E 
stdout
2 3 4 9
1 7 8 E
6 B C D