-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path107b.cpp
More file actions
58 lines (56 loc) · 1.42 KB
/
107b.cpp
File metadata and controls
58 lines (56 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
int H,W;
cin >> H >> W;
vector<vector<char>> bits(H,vector<char>(W));
rep(y,H){
rep(x,W){
string a;
cin >> bits.at(y).at(x) ;
}
}
//bool flag = true;
//while(flag){
rep(y,H){
int count =0;
rep(x,W){
if (bits.at(y).at(x) == '.')count++;
}
if(count == W){
//flag = true;
bits.erase(bits.begin() + y);
H--;
}
//else{flag=false;}
}
rep(x,W){
int count =0;
rep(y,H){
if (bits.at(y).at(x) == '.')count++;
}
if(count == H){
rep(y,H){
bits.at(y).at(x) = 'a';
}
}
//else{//flag=false;}
}
rep(y,H){
rep(x,W){
if (x != H -1){
if(bits.at(y).at(x)=='a')continue;
cout << bits.at(y).at(x);
} else {
if(bits.at(y).at(x)=='a'){
cout << endl;
continue;
}else{
cout << bits.at(y).at(x) << endl;}
}
}
}
return 0;
//}
}