2 solutions

  • 1
    @ 2026-2-22 16:43:34
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
        int n;
        cin>>n;
        int c=0;
        for(int i=0;i<n;i++)
        {
            cout<<"+";
            for(int j=0;j<c-1;j++)
            {
                cout<<"-";
            }
            if(i!=n-1&&i!=0)cout<<"+";
            //else cout<<"-";
            for(int j=0;j<n-2-c;j++)
            {
                cout<<"-";
            }
            c++;
            cout<<"+\n";
        }
    }
    

    Information

    ID
    33
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    6
    Tags
    # Submissions
    20
    Accepted
    10
    Uploaded By