Submission

Status:

PPPPP

Subtask/Task Score:

100/100

Score: 100

User: theem1502

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-09-08 21:42:27

#include <stdio.h>

int main() {
    int tempnum;
    scanf("%d", &tempnum);
    int num = tempnum * 2 - 1;
    char thechar = 'A' + tempnum - 1;
    for (int i = 0; i < num; i++) {
        for (int j = 0; j < num; j++) {
            if (i == j || i + j == num-1) {
                if (i < tempnum) {
                    printf("%c", thechar);
                    
                }
                else {
                    printf("%c", thechar);
                    
                }

            }
            else {
                printf("%c", ' ');
            }
        }

        if (i < tempnum-1) {
            thechar--;
        }
        else {
            thechar++
;        }

        printf("%c", ' ');

        for (int j = 0; j < num; j++) {
            if (i == j || i + j == num-1) {
                printf("%c", '*');

            }
            else {
                printf("%c", ' ');
            }
        }
        printf("\n");
    }
}