#include <bits/stdc++.h>
using namespace std;
int main(){
int n,cur,mx,mn;cin >> n;
string s;cin >> s;
cur = mx = mn = 0;
for(int i = 0;i<n;i++){
if(s[i] == '+') cur++;
else if(s[i] == '-') cur--;
mx = max(mx,cur);
mn = min(mn,cur);
}
char a[mx - mn][n];
cur = mx;
char c = '.';
for(int i = 0;i<n;i++){
if(s[i] == '+') cur--;
if(s[i] == '+') c = '/';
else if(s[i] == '-') c = '\\';
else{c = '_';cur--;};
for(int j = 0;j<mx - mn;j++){
if(j == cur) a[j][i] = c;
else a[j][i] = '.';
}
if(s[i] == '-' or s[i] == '=') cur++;
}
for(int i = 0;i<mx - mn;i++){
for(int j = 0;j<n;j++){
cout << a[i][j];
}
cout << endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |