## DWITE '12 R5 #3 - Triangle Count

View as PDF

Points: 7
Time limit: 1.0s
Memory limit: 64M

Problem type
##### DWITE, February 2013, Problem 3

A typical Q1 level problem is to draw some ASCII triangles. Well, after a bunch of students wrote their attempts, it's time to count the mess. Given a grid with some pattern, how many different triangles could it have been? The ASCII triangles have shapes such as:

        #
#   ###
# ### ##### etc.

The input will contain 5 test cases. The first line of each case is a number representing the size of the square grid, followed by lines describing the grid.

The output will contain 5 lines of output, each a count of different triangles that could be counted. The orientation of the triangles is just as shown above, for the sake of simplicity. In the sample case below, there are triangles of size one, of size three, and of size five, for a total of (The ASCII pattern doesn't support triangles of even length.)

#### Sample Input

5
.....
.###.
.###.
#####
.....

#### Sample Output

16