Submission
Status:
-----------
Subtask/Task Score:
0/100
Score: 0
User: Pera
Problemset: ตั้งฐานทัพ
Language: cpp
Time: 0.067 second
Submitted On: 2025-09-23 15:54:26
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
int n; cin >> n;
// print n lines of underscore and stars
// Each row has n*4 - 1 characters
for (int i = 0; i < n; i++) {
// print underscore
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 underscore
for (int j = 0; j < (n*4 - 1) / 2 - i; j++) {
cout << "_";
}
cout << "\n";
}
// print n lines of underscore, stars and plus sign
for (int i = 0; i < n; i++) {
// print underscore
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 underscore
for (int j = 0; j < n - 1 - i; j++) {
cout << "_";
}
cout << "\n";
}
}