#include<cstdio>
const int maxn=105;
char s[maxn],out[maxn<<1][maxn];
int n,max=maxn-1,min=maxn,now=maxn;
int max_(int a,int b){
return a>b?a:b;
}
int min_(int a,int b){
return a<b?a:b;
}
int main(){
scanf("%d\n%s",&n,s+1);
for(int i=1;i<=n;i++){
if(s[i]=='+')out[now][i]='/',max=max_(max,now),min=min_(min,now++);
else if(s[i]=='-')max=max_(max,--now),min=min_(min,now),out[now][i]='\\';
else out[now][i]='_',max=max_(max,now),min=min_(min,now);
}
for(int i=max;i>=min;i--){
for(int j=1;j<=n;j++)putchar(out[i][j]?out[i][j]:'.');
putchar('\n');
}
return 0;
}
Compilation message
crtanje.cpp: In function 'int main()':
crtanje.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
12 | scanf("%d\n%s",&n,s+1);
| ~~~~~^~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |