Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
749 B
2
Indexable
Never
#include<iostream>
#include<fstream>
using namespace std;
int main()
{ int v[41][41], n, k, i, j, x;

  ifstream f("bac.txt");

  cin >> n >> k;
  
  for ( i = 1; i <= n; i ++) {
      
      for( j = 1; j <= n; j ++)
       
         f >> v[i][j];
         
  }
    
    
    for ( i = 1; i <= k - 2; i ++) {
        
          x = v[k][i - 1];
        
        for ( j = k - 1; j >= 1; j --) {
            
            v[k][j] = v[k][j - 1];
            
            v[k][j - 1] = x;
         }
         
         v[k][1] = x;
    }
    
    for ( i = 1; i <= n; i ++) {
        
        for ( j = 1; j <= n; j ++)
            
            cout << v[i][j] << " ";
            
     cout << endl;
    }
               
               return 0;
}