#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
int n;
string s;
cin >> n >> s;
vector<vector<char>> m(n, vector<char>(200, '.'));
int h = 100;
for (int i = 0; i < n; i++) {
if (s[i] == '+') {
m[i][h] = '/';
h++;
}
else if (s[i] == '-') {
h--;
m[i][h] = '\\';
}
else if (s[i] == '=') {
m[i][h] = '_';
}
}
int lo = -1, hi = -1;
for (int j = 0; j < 200; j++) {
for (int i = 0; i < n; i++) {
if (m[i][j] != '.') {
if (lo == -1) lo = j;
hi = j;
}
}
}
for (int j = hi; j >= lo; j--) {
for (int i = 0; i < n; i++) {
cout << m[i][j];
}
cout << '\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |