Submission
Status:
-----
Subtask/Task Score:
0/100
Score: 0
User: Kei
Problemset: กังหันสี่ทิศ
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-07 11:42:48
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void printRow(int n, int d, char ch){
for(int j=0; j<n-1-d; j++) cout << ' '; // (1) spaces before the first ch
cout << ch;
if(d > 0){ // the middle row (d = 0) has only one ch
for(int j=0; j<2*d-1; j++) cout << ' '; // (2) spaces between the two ch
cout << ch;
}
for(int j=0; j<n-1-d; j++) cout << ' '; // (3) spaces after the second ch
}
void solve(){
int n;
cin >> n;
for(int r=0; r<2*n-1; r++){ // (4) total number of rows
int d = abs(r-(n-1)); // (5) distance from the middle row
printRow(n, d, char('A'+d)); // (6) the letter for this row
cout << " "; // the gap between the two pictures
printRow(n, d, '*'); // same row, drawn with stars
cout << '\n';
}
}
void sowlve(){
int n;
cin >> n;
for(int i=1;i<=n;i++){
for(int j=1;j<i;j++) cout<<' ';
cout << char('A'+n-i);
for(int j=0;j<2*(n-i)-1;j++) cout<<' ';
if(i!=n) cout << char('A'+n-i);
for(int j=1;j<i;j++) cout<<' ';
cout << '\n';
}
for(int i=1;i<n;i++){
for(int j=i;j<n-1;j++) cout<<' ';
cout << char('A'+i);
for(int j=0;j<(2*i)-1;j++) cout<<' ';
cout << char('A'+i);
for(int j=i;j<n-1;j++) cout<<' ';
cout << '\n';
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}