Блог пользователя forget_it

Автор forget_it, история, 4 года назад, По-английски

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??

  • Проголосовать: нравится
  • -11
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Read your question again, slowly.

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Errichto had a video where he solved a generalization of this problem on the spot: part (1) was count all axis-aligned rectangles formed by a given set of points, and part (2) was count all general rectangles (your problem asks for only squares, and the set of points is very regular). Nevertheless maybe you can gather some ideas from it:

https://youtu.be/EuPSibuIKIg?t=109

»
4 года назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится

ogo tickets..