stea Gigel got the task
of making the star that will be put on top of the school's Christmas tree.
To do this he prepared a silver sheet of paper in the shape of an equilateral
triangle. The sheet of paper has a very nice design. It is divided into
n bands. Each band has
a model made up of small equilateral triangles, (having a side length
of 1 cm), placed alternatively (one with the top up, the next with the
top down, etc), like in the image. |
Task Determine the number of small equilateral triangles contained by the largest (maximum possible) equilateral triangle area not having any holes. Input Data Input file stea.in contains on the first line a positive integer n representing the number of bands of the triangle. The following n lines contain information about the look of the sheet of paper. Line i+1 contains a sequence of characters representing the ith band of the sheet of paper. The characters from the sequence can be # (which means that the small triangle was cut out) or - (which means that the small triangle hasn't been cut out) or a space (used at the beginning of each line, in order to keep the sheet's triangular aspect). Output Data Output file stea.out contains a single line with a positive integer, representing the number of small equilateral triangles from which the largest equilateral triangle shaped area that doesn't contain any holes is made of. Restrictions
Examples
Time limit: 0.2 seconds/test Marinel Serban
|