Editorial for JDCC '16 Contest 3 P2 - The Number Eight


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: aurpine

Do some math to hardcode the drawings. We can consider this as two operations: line across and lines down.

Order

Do the operations in the order: across, down, across, down, across.

Line Across

Print (H + 1) / 2 stars. Let's call this number W because it is the width of the eight.

Line Down

Print a star; print W - 2 spaces; print another star. (next line)

Do the above W - 2 times.

Time Complexity: \mathcal{O}(H^2)


Comments

There are no comments at the moment.