Submission

Status:

-----

Subtask/Task Score:

0/100

Score: 0

User: snadwixh

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

Language: cpp

Time: 0.003 second

Submitted On: 2026-10-03 12:00:00

#include <iostream>
using namespace std;
int main() {
    int n,a;
    cin >> n;
    a = 2*n-3;
    int ch = n-1;
    int s = 0;
    for (int i = 0; i<n*2-1; i++) {
        if (i == n-1) {
            for (int j = 0;j<s; j++) {
                cout << " ";
            }
            cout << char('A'+ ch);
            for (int j = 0;j<s; j++) {
                cout << " ";
            }
            for (int j = 0;j<s; j++) {
                cout << " ";
            }
            cout << "*";
            for (int j = 0;j<s; j++) {
                cout << " ";
            }
            a=1;
            ch=1;
            s--;
            cout << '\n';
            continue;
        }
        for (int j = 0;j<s; j++) {
            cout << " ";
        }
        cout << char('A'+ ch);
        for (int j=0;j<a;j++) {
            cout << " ";
        }
        cout << char('A' + ch);
        for (int j = 0;j<s; j++) {
            cout << " ";
        }
        for (int j = 0;j<s; j++) {
            cout << " ";
        }
        cout << "*";
        for (int j=0;j<a;j++) {
            cout << " ";
        }
        cout << "*";
        if (i<n-1) {
            a-=2;
            ch--;
            s++;
        }
        else if (i>n-1) {
            a+=2;
            ch++;
            s--;
        } 
        cout << '\n';
    }
    
}