Submission
Status:
-----
Subtask/Task Score:
0/100
Score: 0
User: tonkla
Problemset: กังหันสี่ทิศ
Language: cpp
Time: 0.004 second
Submitted On: 2026-09-28 21:03:56
#include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
int x=2*n-1;
int center = n-1;
for(int i=0; i< x;i++ ){
for (int j =0;j<x;j++){
if(i==j || i+j==x-1){
int row;
if(i>=center){
row =i-center;
}
else{
row=center-i;
}
int coll;
if(j>=center){
coll =j-center;
}
else{
coll=center-j;
}
int distance;
if(row<coll){
distance=coll;
}
else{
distance=row;
}
char abc='A'+(n-1-distance);
cout<<abc;
}
else{
cout<<" ";
}
}
cout<<" ";
for(int j=0; j<x;j++){
if(i==j||i+j==x-1){
cout<<"*";
}
else{
cout<<" ";
}
}
cout<<"\n";
}
}