? 解题记录 ? ? 洛谷 ? ? 模拟 ?    2018-10-29 23:17:40    635    0    0

## 输入输出样例

```3 4
TST.
S.TT
TSST```

```o-o-o o
|   |
o o o-o
|     |
o-o-o-o```

## 怕是做题做傻了

```#include<cstdio>
using namespace std;
const int maxn = 805;
int n, m, last;
char mp[maxn][maxn];
int D[maxn][maxn], R[maxn][maxn];

int main() {
scanf("%d%d", &n, &m);
for(register int i = 1; i <= n; ++i)
scanf("%s", mp[i] + 1);
for(register int i = 1; i <= n; ++i) {
last = 0;
for(register int j = 1; j <= m; ++j)
if(mp[i][j] == 'T')
if(last) {
for(register int k = last; k <= j - 1; ++k)
R[i][k] = 1;
last = 0;
}
else last = j;
}
for(register int i = 1; i <= m; ++i) {
last = 0;
for(register int j = 1; j <= n; ++j)
if(mp[j][i] == 'T')
if(last) {
for(register int k = last; k <= j - 1; ++k)
D[k][i] = 1;
last = 0;
}
else last = j;
}
for(register int i = 1; i <= n; ++i) {
for(register int j = 1; j <= m; ++j) {
putchar('o');
if(R[i][j]) putchar('-');
else putchar(' ');
}
if(i == n) break;
putchar('\n');
for(register int j = 1; j <= m; ++j) {
if(D[i][j]) putchar('|');
else putchar(' ');
putchar(' ');
}
putchar('\n');
}
return 0;
}```

635 人读过

0 条评论