답안 #473760

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
473760 2021-09-16T08:28:26 Z MamdouhN Crtanje (COCI20_crtanje) C++17
30 / 50
1 ms 332 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"

char ar[300][300];

main()
{
    for(int i=0;i<300;i++)for(int j=0;j<300;j++)ar[i][j]='.';
    int n;
    string s;
    cin>>n>>s;
    int i = 101 , j=0,mx=0,mn=1e9;
    for(int o=0;o<n;o++)
    {
        char c;
        if(s[o]=='+')c='/';
        if(s[o]=='-')c='\\';
        if(s[o]=='=')c='_';
        ar[i][j]=c;
        mx=max(mx,i);
        mn=min(mn,i);
        if(o==n-1)continue;
        j++;
        if(s[o]=='+'&&s[o+1]!=' -')i--;
        if(s[o]=='-'&&s[o+1]=='-')i++;
    }
    for(int i = mn;i<=mx;i++)
    {
        for(int j=0;j<n;j++)cout<<ar[i][j];
        cout<<endl;
    }
}

Compilation message

crtanje.cpp:26:31: warning: multi-character character constant [-Wmultichar]
   26 |         if(s[o]=='+'&&s[o+1]!=' -')i--;
      |                               ^~~~
crtanje.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~
crtanje.cpp: In function 'int main()':
crtanje.cpp:21:17: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
   21 |         ar[i][j]=c;
      |         ~~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Incorrect 1 ms 332 KB Output isn't correct
4 Incorrect 1 ms 332 KB Output isn't correct
5 Correct 1 ms 332 KB Output is correct