Project Euler #147: Rectangles in cross-hatched grids

  • + 1 comment

    Let grid size is MxN (M<=N)

    for upright rectangles of m <= M & n <= N
    number of rectangles possible is (1+(M-m))*(1+(N-n)) usin this I can get upright rectangles of all sizes.


    for diagonal rectangles I could only figure out for 1xn (and nx1) sizes.


    how to figure out rest of the diagonal rectangles?

    Any help!