Submission
Status:
PPPPP
Subtask/Task Score:
100/100
Score: 100
User: PROb221
Problemset: กังหันสี่ทิศ
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-04 16:19:39
#include <iostream>
using namespace std;
#define ll int long long
int depth(int i, int j, int n) {
ll d=min(min(i,j),min(n-i-1,n-j-1));
return d;
}
int main() {
ios_base::sync_with_stdio;
cin.tie(0);
ll n;
cin>>n;
// 3>5
// 4>7
// 5>9
char c=(char)('A'+n-1);
n=n*2-1;
ll i,j,d;//d is depth
for(i=0;i<n;i++) {
for(j=0;j<n;j++) {
if(i==j) {
cout<<(char)(c-depth(i,j,n));
}
else if(i+j+1==n) {
cout<<(char)(c-depth(i,j,n));
}
else {
cout<<" ";
}
}
cout<<" ";
for(j=0;j<n;j++) {
if(i==j) {
cout<<"*";
}
else if(i+j+1==n) {
cout<<"*";
}
else {
cout<<" ";
}
}
cout<<"\n";
}
return 0;
}