Submission

Status:

PPPPP

Subtask/Task Score:

100/100

Score: 100

User: loop

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

Language: cpp

Time: 0.003 second

Submitted On: 2026-10-10 18:36:45

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

// Two X-shaped windmills of width 2n-1 (letters, then '*'), separated by exactly one space (the note on
// gchan's problem page; the PDF figure is hand-spaced).
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 + ' ' + b;
        while (!line.empty() && line[line.size() - 1] == ' ') line.erase(line.size() - 1);
        cout << line << '\n';
    }
    return 0;
}