一道acm简单题,思路不明
题目:Problem Description
By counting carefully it can be seen that a rectangular grid measuring 3 by 2 contains eighteen rectangles:
But how many rectangles a rectangular grid measuring n by m contains ?
Input
The input file consists of one line containing n and m (1 <= n <= 100, 1 <= m <= 100).
Output
The output should print the number of rectangulars.
Sample Input
3 2
Sample Output
18
;
我想问下下这道题的思路,那位大牛能指点一下谢谢
[解决办法]
n*(n+1)/2 * m*(m+1)/2
[解决办法]
哦 我懂了 意思是说画出2行3列的表格(3行2列也行,都一样) 然后数出你所能看见的所有矩形 但不能重复 可是我只数出14个
[解决办法]