Submission
Status:
PPPPP
Subtask/Task Score:
100/100
Score: 100
User: Kei
Problemset: กังหันสี่ทิศ
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-07 11:49:21
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int GAP = 1; // spaces between the two pinwheels: change this one number to match your grader
void printRow(int n, int d, char ch, bool trailing){
for(int j=0; j<n-1-d; j++) cout << ' ';
cout << ch;
if(d > 0){
for(int j=0; j<2*d-1; j++) cout << ' ';
cout << ch;
}
if(trailing) for(int j=0; j<n-1-d; j++) cout << ' ';
}
void solve(){
int n;
cin >> n;
for(int r=0; r<2*n-1; r++){
int d = abs(r-(n-1));
printRow(n, d, char('A'+d), true); // letters: full width, so the stars line up
for(int j=0; j<GAP; j++) cout << ' ';
printRow(n, d, '*', false); // stars: no spaces after the last '*'
cout << '\n';
}
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}