Submission
Status:
PPPPP
Subtask/Task Score:
100/100
Score: 100
User: KanemiyaKana
Problemset: กังหันสี่ทิศ
Language: cpp
Time: 0.004 second
Submitted On: 2026-09-23 15:35:17
#include <iostream>
#include <string>
using namespace std;
// comment hell cause im short memori-ed
string amount(int times)
{
int maxlettersononeside = times - 1;
int rankoflastalphabet = times - 1;
string returnstring = "";
string line[] = {"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T"}; // gotta start at 0 and end at n - 1 when you wanna loop
string asterisk[] = {"*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*", "*"}; // could js ditch this and do a simple asterisk but nah bro fuck that
string a = "";
string Aline = "";
for (int i = rankoflastalphabet; i > 0; i--) // from uppermost alphabet line to B (before A)
{
string totaloneline = ""; // putting these inside the for loop so that everytime it repeats it will then be set back to nothing
string whitespaceafterletter1_STR = ""; // putting these inside the for loop so that everytime it repeats it will then be set back to nothing
string whitespacebeforeletter1_STR = ""; // putting these inside the for loop so that everytime it repeats it will then be set back to nothing
string whitespaceafterletter2_STR = ""; // putting these inside the for loop so that everytime it repeats it will then be set back to nothing
string whitespacebeforeletter2_STR = ""; // putting these inside the for loop so that everytime it repeats it will then be set back to nothing
// i am aware that there are better ways to go around this but i prefer to be clear instead of cutting lines of code
int amountoflastalphabetwhitespace1 = i - 1; // only top part, add one whitespace manually after do one loop then run another loop
int amountoflastalphabetwhitespace2 = i - 1;
int whitespacebeforeletter1 = maxlettersononeside - i;
int whitespacebeforeletter2 = maxlettersononeside - i;
while (whitespacebeforeletter1 > 0)
{
whitespacebeforeletter1_STR += " ";
whitespacebeforeletter1--;
}
totaloneline += whitespacebeforeletter1_STR;
totaloneline += line[i];
while (amountoflastalphabetwhitespace1 > 0)
{
whitespaceafterletter1_STR += " ";
amountoflastalphabetwhitespace1--;
}
totaloneline += whitespaceafterletter1_STR;
totaloneline += " ";
while (amountoflastalphabetwhitespace2 > 0)
{
whitespacebeforeletter2_STR += " ";
amountoflastalphabetwhitespace2--;
}
totaloneline += whitespacebeforeletter2_STR;
totaloneline += line[i];
while (whitespacebeforeletter2 > 0)
{
whitespaceafterletter2_STR += " ";
whitespacebeforeletter2--;
}
totaloneline += whitespaceafterletter2_STR;
// adding the asterisks after making the letters
totaloneline += " ";
totaloneline += whitespacebeforeletter1_STR;
totaloneline += asterisk[i];
totaloneline += whitespaceafterletter1_STR;
totaloneline += " ";
totaloneline += whitespacebeforeletter2_STR;
totaloneline += asterisk[i];
totaloneline += whitespaceafterletter2_STR;
returnstring += totaloneline + "\n";
}
if (times >= 1)
{
int Awhitespace = times - 1;
for (int k = Awhitespace; k > 0; k--)
{
Aline += " ";
}
a += Aline;
a += "A";
a += Aline;
a += " ";
a += Aline;
a += "*";
a += Aline;
returnstring += a + "\n";
}
for (int i = 1; rankoflastalphabet >= i; i++) // from B back up to the last alphabet
{
string totaloneline = ""; // putting these inside the for loop so that everytime it repeats it will then be set back to nothing
string whitespaceafterletter1_STR = ""; // putting these inside the for loop so that everytime it repeats it will then be set back to nothing
string whitespacebeforeletter1_STR = ""; // putting these inside the for loop so that everytime it repeats it will then be set back to nothing
string whitespaceafterletter2_STR = ""; // putting these inside the for loop so that everytime it repeats it will then be set back to nothing
string whitespacebeforeletter2_STR = ""; // putting these inside the for loop so that everytime it repeats it will then be set back to nothing
// i am aware that there are better ways to go around this but i prefer to be clear instead of cutting lines of code
int amountoflastalphabetwhitespace1 = i - 1; // only top part, add one whitespace manually after do one loop then run another loop
int amountoflastalphabetwhitespace2 = i - 1;
int whitespacebeforeletter1 = maxlettersononeside - i;
int whitespacebeforeletter2 = maxlettersononeside - i;
while (whitespacebeforeletter1 > 0)
{
whitespacebeforeletter1_STR += " ";
whitespacebeforeletter1--;
}
totaloneline += whitespacebeforeletter1_STR;
totaloneline += line[i];
while (amountoflastalphabetwhitespace1 > 0)
{
whitespaceafterletter1_STR += " ";
amountoflastalphabetwhitespace1--;
}
totaloneline += whitespaceafterletter1_STR;
totaloneline += " ";
while (amountoflastalphabetwhitespace2 > 0)
{
whitespacebeforeletter2_STR += " ";
amountoflastalphabetwhitespace2--;
}
totaloneline += whitespacebeforeletter2_STR;
totaloneline += line[i];
while (whitespacebeforeletter2 > 0)
{
whitespaceafterletter2_STR += " ";
whitespacebeforeletter2--;
}
totaloneline += whitespaceafterletter2_STR;
// adding the asterisks after making the letters
totaloneline += " ";
totaloneline += whitespacebeforeletter1_STR;
totaloneline += asterisk[i];
totaloneline += whitespaceafterletter1_STR;
totaloneline += " ";
totaloneline += whitespacebeforeletter2_STR;
totaloneline += asterisk[i];
totaloneline += whitespaceafterletter2_STR;
returnstring += totaloneline + "\n";
}
return returnstring;
}
int main()
{
int input;
cin >> input;
if (1 > input || input > 20)
{
return 0;
}
else
{
string output = amount(input);
cout << output;
}
}