Just something that comes to my mind

I assume that the size (size = length of any side) of the biggest triangle
is n. Not sure how it can be derived from 10. Infact, I cudnt get what is 10
here :P

The number of triangles with size k (excluding the upside down ones) in row
i from top will be 0 if i < k and (i-k+1) if i >= k . I am counting those
triangles who have base in the ith row and are not upside down.

Now, count the number of triangles upside down in row i (assume this is
having the bottom vertex in the ith row). It will be 0 if i < 2*k and (i -
2*k + 1) if i >= 2*k.

Sum these to for i from 1 to n.

Then sum the result from k = 1 to n.

I think you can easily derive a mathematical formula for it .. didnt try

For your qn,

k=1:
  i = 1: 1+0
  i = 2: 2+1
  i = 3: 3+2
    => 9
k=2:
  i = 1: 0+0
  i = 2: 1+0
  i = 3: 2+0
    => 3
k=3:
  i = 1: 0+0
  i = 2: 0+0
  i = 3: 1+0
    => 1

so ans = 9+3+1 = 13

2009/10/19 2shar007 <[email protected]>

>
> In the puzzle,              /_\
>                                 /_\/_\
>                               /_\/_\/_\     this is having 10
> vertices, we are to find the no.of triangles which is 13 here
>
> I tried to derive a general formula, but couldn't :(
> What I understood was triangles have vertices as n(n+1)/2,
> n=2,3,4,5..................
>
> Also that the no. of triangles for k(k+1)/2 vertices is no.of
> triangles in k(k-1)/2 + triangles of all sizes with  atleast one
> vertex in the larger triangle.
>
> will be grateful if someone could give a fitting reply
> Thanks in advance
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to