Advertisement
kokokozhina

606

Dec 12th, 2015
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int n, m;
  10.     scanf("%d%d", &n, &m);
  11.     vector<int> column(m, 0);
  12.     for(int i = 0; i < n; i++)
  13.     {
  14.         for(int j = 0; j < m; j++)
  15.         {
  16.             char c;
  17.             cin >> c;
  18.             if (c == '*')
  19.                 ++column[j];
  20.         }
  21.     }
  22.     int imin = 0;
  23.     for(int j = 1; j < m; j++)
  24.     {
  25.         if (column[j] < column[imin])
  26.             imin = j;
  27.     }
  28.     int difference = column[imin];
  29.     for(int j = 0; j < m; j++)
  30.         column[j] = n + difference - column[j];
  31.     for(int i = 0; i < n; i++, cout << endl)
  32.         for(int j = 0; j < m; j++)
  33.             if (column[j] <= i)
  34.                 cout << "*";
  35.             else
  36.                 cout << ".";
  37.  
  38.    
  39.     system("pause");
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement