Advertisement
rotti321

permutare circ stanga

May 31st, 2021
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1.  
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. int v[21][21],n,k,x;
  8. cin>>n>>k;
  9. for(int i=1;i<=n;i++){
  10. for(int j=1;j<=n;j++){
  11. cin>>v[i][j];
  12. }
  13. }
  14. x=v[k][1];
  15. for(int j=1;j<=n-k-1;j++){
  16. v[k][j] = v[k][j + 1];
  17. }
  18. v[k][n-k]=x;
  19.  
  20. for(int i=1;i<=n;i++){
  21. for(int j=1;j<=n;j++){
  22. cout<<v[i][j]<<" ";
  23. }
  24. cout<<endl;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement