2 solutions

  • 2
    @ 2025-11-2 13:50:13
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	for(int i=1;i<=n;i++)
    	{
    		for(int j=1;j<=n;j++)
    		{
    			if(i==j||j==1||j==n)
    			{
    				cout<<"+";
    			}
    			else 
    			{
    				cout<<"-";
    			}
    	    }
    	    cout<<endl;
    	}
    	return 0;
    }

    Information

    ID
    2196
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    6
    Tags
    # Submissions
    17
    Accepted
    12
    Uploaded By