Submission

Status:

PPPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Pera

Problemset: ออลสปาร์ค

Language: cpp

Time: 0.115 second

Submitted On: 2025-09-23 15:56:27

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

int main() {
    ios_base::sync_with_stdio(false);
    int n; cin >> n;

    // print n lines of dash and stars
    // Each row has n*4 - 1 characters
    for (int i = 0; i < n; i++) {
        // print dash
        for (int j = 0; j < (n*4 - 1) / 2 - i; j++) {
            cout << "-";
        }

        // print stars
        for (int j = 0; j < ((i + 1) * 2) - 1; j++) {
            cout << "*";
        }

        // print dash
        for (int j = 0; j < (n*4 - 1) / 2 - i; j++) {
            cout << "-";
        }

        cout << "\n";
    }

    // print n lines of dash, stars and plus sign
    for (int i = 0; i < n; i++) {
        // print dash
        for (int j = 0; j < n - 1 - i; j++) {
            cout << "-";
        }

        // print stars
        for (int j = 0; j < ((i + 1) * 2) - 1; j++) {
            cout << "*";
        }

        // print plus sign
        for (int j = 0; j < (n * 2) - 1 - (i * 2); j++) {
            cout << "+";
        }

        // print stars
        for (int j = 0; j < ((i + 1) * 2) - 1; j++) {
            cout << "*";
        }

        // print dash
        for (int j = 0; j < n - 1 - i; j++) {
            cout << "-";
        }

        cout << "\n";
    }
}