Submission

Status:

PPPPP

Subtask/Task Score:

100/100

Score: 100

User: Boeing12345

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-03 12:22:37

#include <iostream>
using namespace std;
int main(){
    int n;
    cin >> n;
    int a = 0;
    int b = n;
    int c;
    c = 2 * n - 2;

    for(int i = 0; i < n*2-1; i++){
        for(int j = 0; j < a; j++){
            cout << " ";
        }
        cout << char(b + 64);
        for(int j = 0; j < c-1; j++){
            cout << " ";
        }
        if(b != 1){
            cout << char(b+64);
        }
        for(int j = 0; j < 2*a + 1; j++){
            cout << " ";
        }
        cout << "*";
        for(int j = 0; j < c-1; j++){
            cout << " ";
        }
        if(b != 1){
            cout << "*";
        }

        if(i < n-1){
            b = b - 1;
            a = a + 1;
            c = c - 2;
        } else {
            b = b + 1;
            a = a - 1;
            c = c + 2;
        }
        cout << endl;
    }
}