We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

# Project Euler #163: Cross-hatched triangles

# Project Euler #163: Cross-hatched triangles

#### Sort by

recency

#### |

#### 6 Discussions

#### |

Please Login in order to post a comment

public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); int result = calculateTriangleCount(n); System.out.println(result); }

scince it is an equilateral triangle all straight lines drawn from each vertex to the middle of the opposite side is also a height.Pay attention on the directions formed by the divisions,parallel segments will help to count those triangles.It is not possible to find a close formula for this problem

Can anybody help me in this problem...?

As in the size two triangles we will be having 4 size 1 triangles i.e minimum number of triangle of any size will be 16*4=64. I am not getting how to find the rest as per the discussion below considering angles also apart from 30,60,90 which is the case of special triangle we can judge that rest triangle will be having minimum two angles equal so as to make two two opposite sides euqal. But How we can consider the angle parameter...

Please help me in solving this.

Failing the testcases 2,3,8,9. Any hints on what could be the cause. I have tried some small numbers for which I calculated the triangles and I got correct results through my code.