Advertisement
yejolga

ol_5_13

Nov 16th, 2019
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <vector>
  4.  
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     ifstream cin("input.txt");
  11.  
  12.     int n, m;
  13.     cin>>n>>m;
  14.     vector <vector <int> > a;
  15.     a.resize(n);
  16.     for(int i = 0; i < n; i++)
  17.     {
  18.         a[i].resize(m);
  19.         for(int j = 0; j < m; j++)
  20.             cin>>a[i][j];
  21.     }
  22.  
  23.     for(int i = 0; i < m; i++)
  24.     {
  25.         for(int j = 0; j < n; j++)
  26.             cout<<a[j][i]<<' ';
  27.         cout<<'\n';
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement