1 solutions

  • 0
    @ 2024-12-5 18:19:39

    C++ :

    #include <bits/stdc++.h>
    using namespace std;
    
    int main() {
    	int n;
    	cin >> n;
    	for (int i = 0; i < n; i++) {
    		for (int j=0;j<n;j++) {
    			bool cd1 = (i == j);
    			bool cd2 = (j == (n-i-1));
    			if(cd1||cd2){
    				cout << '+';
    			}else{
    				cout << '-';
    			} 
    		}
    		cout<<endl;
    	}
    }
    
    • 1

    Information

    ID
    9151
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By