Submission

Status:

PPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Pera

Problemset: ฝุ่นธุลีล้อมดาว

Language: cpp

Time: 0.062 second

Submitted On: 2025-09-04 18:03:27

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);

    int n; cin >> n;
    if (n == 1) cout << '*' << '\n';
    else {
        // print leading lines
        for (int i = 0; i < n - 1; i++) {
            // print dash
            for (int j = i; j < n - 1; j++) cout << '-';
            // print plus
            for (int j = 0; j < i; j++) cout << '+';
            // print middle plus
            cout << '+';
            // print plus
            for (int j = 0; j < i; j++) cout << '+';
            // print dash
            for (int j = i; j < n - 1; j++) cout << '-';
            // print space
            cout << '\n';
        }   
        // print middle line
        // print plus
        for (int i = 0; i < n - 1; i++) cout << '+';
        cout << '*';
        for (int i = 0; i < n - 1; i++) cout << '+';
        cout << '\n';
        
        // print ending lines
        for (int i = 0; i < n - 1; i++) {
            // print dash
            for (int j = 0; j <= i; j++) cout << '-';
            // print plus
            for (int j = n; j > i + 2; j--) cout << '+';
            // print middle plus
            cout << '+';
            // print plus
            for (int j = n; j > i + 2; j--) cout << '+';
            // print dash
            for (int j = 0; j <= i; j++) cout << '-';
            // print space
            cout << '\n';
        }   
    }
}