Submission

Status:

-----

Subtask/Task Score:

0/100

Score: 0

User: loop

Problemset: กังหันสี่ทิศ

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-10 18:35:22

#include <iostream>
#include <string>
using namespace std;

// Two X-shaped windmills of width 2n-1 (letters, then '*'), separated by n-1 spaces.
int main() {
    int n;
    cin >> n;
    int w = 2 * n - 1;
    for (int i = 0; i < w; i++) {
        int k = i < n ? n - 1 - i : i - (n - 1);      // distance from the pivot row
        string a(w, ' '), b(w, ' ');
        a[i] = a[w - 1 - i] = char('A' + k);
        b[i] = b[w - 1 - i] = '*';
        string line = a + string(n - 1, ' ') + b;
        while (!line.empty() && line[line.size() - 1] == ' ') line.erase(line.size() - 1);
        cout << line << '\n';
    }
    return 0;
}