답안 #473925

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473925 2021-09-16T12:17:42 Z Ahmed57 Crtanje (COCI20_crtanje) C++14
50 / 50
1 ms 332 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    char arr[n];
    for(int i = 0;i<n;i++){
        cin>>arr[i];
    }
    char gr[400][n];
    for(int i = 0;i<400;i++){
        for(int j = 0;j<n;j++)gr[i][j] = '.';
    }
    int x = 200,y = 0;
    int mi = 1e4 , ma = 0;
    for(int i = 0;i<n;i++){
        mi = min(mi,x);
        ma = max(ma,x);
        if(arr[i]=='+'){
            gr[x][y] = '/';
            if(i<n-1&&arr[i+1]=='-'){
                y++;
            }else{
                x--;y++;
            }
        }else if(arr[i]=='-'){
            gr[x][y] = '\\';
            if(i<n-1&&(arr[i+1]=='+'||arr[i+1]=='=')){
                y++;
            }else{
                x++;y++;
            }
        }else{
            gr[x][y] = '_';
            if(i<n-1&&(arr[i+1]=='-')){
                y++;x++;
            }else y++;
        }
    }
    for(int i = mi;i<=ma;i++){
        for(int j = 0;j<n;j++){
            cout<<gr[i][j];
        }
        cout<<"\n";
    }
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct