Submission
Status:
-----
Subtask/Task Score:
0/100
Score: 0
User: porpeang
Problemset: กังหันสี่ทิศ
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-02 13:57:39
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
int main() {
int N;
if (!(cin >> N) || N < 1 || N > 20) {
return 0;
}
int center_box1 = 2 * N - 2;
int shift = 5 * N - 1;
int center_box2 = center_box1 + shift;
int total_rows = 2 * N - 1;
for (int r = 0; r < total_rows; r++) {
int d = abs(r - (N - 1));
char char_letter = 'A' + d;
int max_col = (d > 0) ? (center_box2 + 2 * d) : center_box2;
string line(max_col + 1, ' ');
if (d == 0) {
line[center_box1] = 'A';
line[center_box2] = '*';
} else {
line[center_box1 - 2 * d] = char_letter;
line[center_box1 + 2 * d] = char_letter;
line[center_box2 - 2 * d] = '*';
line[center_box2 + 2 * d] = '*';
}
cout << line << "\n";
}
return 0;
}