> > > > Counting the number of triangles with code < < < <
Create:  2017-02-05 Update:  2017-02-05 Views:  153 Tags:  Counting the number of triangles with code,count triangles

Counting triangles with code

Description:
Recently I found that picture from my friends circle, that's a picture of counting the number of the triangles, so I want to count it with code.


Question:
Please count the number of triangles in the picture.

Count triangles with code


Resolve and Analysis:
Taking the letters to each of the corner and cross point. Using undirected graph, if there are three points and these three points are not in a straight line, it means that's a triangle.


Resolve:

Coun triangles with code

code:

Result:

Result

The result is 35.

Extension: 

That's not the best way, you can fix it as you want.
--| Home |-- --| Others |-- --| About Us |-- --| Downloads |--