Advertisement
artur99

Untitled

Jul 5th, 2017
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. // 5 4
  3. // 0 5 2 11 3 2 10 2 7 3 1 4 4 5 0 12 8 13 7 5
  4. using namespace std;
  5.  
  6. int main(){
  7.     int a[50][50], m, n, i, j, le;
  8.     cin>>n>>m;
  9.     for(i=0;i<n;i++)
  10.         for(j=0;j<m;j++)
  11.             cin>>a[i][j];
  12.     le = a[n-1][m-1];
  13.  
  14.     for(i=0;i<n;i++){
  15.         a[i][0] = le;
  16.         a[i][m-1] = le;
  17.     }
  18.     for(i=1;i<m;i++){
  19.         a[0][i] = le;
  20.         a[n-1][i] = le;
  21.     }
  22.  
  23.     for(i=0;i<n;i++){
  24.         for(j=0;j<m;j++)
  25.             cout<<a[i][j]<<' ';
  26.         cout<<endl;
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement