1 / 5
Oct 2011

I am getting WA in Counting Triangles (CT)
My approach is basically to count all the triangles in all directions for all lengths and add them up.
I found few test cases on net and it is working for them but I am still getting WA frowning

removed after AC :)

Result of some test cases by program:
4
3 3
10 10
100 100
1000 1000

Output:
96
6020
43351700
418335167000

Have you considered grids that have non-zero X and Y, and are not perfect square?

yups!! i am counting triangles for all x and y and for all rotations possible! but still getting wa frowning

1
1 2

Thanks!! Got AC smile
The test cases for which I could verify were all perfect squares. Your pointer made me spot the bug!