Help in this Geometrical (counting) concept..

Revision en1, by forget_it, 2020-03-16 16:01:50

How to count number of squares posible in a m*n grid.

I know formula to count squares which are parallel to given grid. i.e. m*(m+1)*(2m+1)/6 + (n-m)*m*(m+1)/2;

but how to do it for squares which are not parallel to given grid. How to count them??

Tags #counting, #c++, #competitive, #geometry

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English forget_it 2020-03-16 16:01:50 305 Initial revision (published)