Snowflakes
SRM 291 · 2006-02-21 · by Andrew_Lazarev
Problem Statement
Paper snowflakes make great decorations and they are easy to make. Take a sheet of square checkered paper with an even number of squares on each side. Fold it in half, folding the upper part up and over to the bottom part, so that you have a rectangle. Now fold that rectangle in half lengthwise, from left to right, to make a smaller square. Next, take the right upper corner of that square and fold it up and over to the left bottom corner, forming a triangle (see pictures below, cells which stay immovable after all foldings are marked red on the fifth picture). Cut out some squares along grid lines (as shown on the last picture).
?
?
?
?
?
You will be given a
Constraints
- snowflake will contain between 1 and 50 elements, inclusive.
- The ith element of snowflake (0-indexed) will contain exactly i+1 characters.
- Each element of snowflake will contain only characters '*' or '.'.
{".",
"..",
"*.*"}
Returns: {"*.**.*", "......", "*....*", "*....*", "......", "*.**.*" }
{"*",
"..",
".*.",
".**.",
".*.**"}
Returns: {"**.*..*.**", "*.**..**.*", ".*.*..*.*.", "***....***", "....**....", "....**....", "***....***", ".*.*..*.*.", "*.**..**.*", "**.*..*.**" }
{".",
"..",
"***"}
Returns: {"******", "*....*", "*....*", "*....*", "*....*", "******" }
{"*",
".*",
"***"}
Returns: {"******", "**..**", "*.**.*", "*.**.*", "**..**", "******" }
{".",
"..",
"***",
"...."}
Returns: {"........", ".******.", ".*....*.", ".*....*.", ".*....*.", ".*....*.", ".******.", "........" }
Submissions are judged against all 68 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class Snowflakes with a public method vector<string> flareOut(vector<string> snowflake) · 68 test cases · 2 s / 256 MB per case