Test Instructions Summary: The last small a, with your help, succeeded in separating the first part of the sage array-the triangle-and now he is ready to draw the second part of the law-the MO-Test rectangle.
And he came across a problem, and he didn't know how many different rectangles there were.
Uphold the help of the end, send the Buddha to the west of the Basic Law, you need to tell him the number of different rectangles.
Problem Analysis: If the rectangle length is 1, the width is m, then the number of rectangles can be composed of m+m-1+.......+1, that is, m* (m+1)/2, if the length is n then just
multiplied by N (n+1)/2; Get Formula s=n*m* (n+1) * (m+1)/4.
1#include"Cstdio"2 intMain ()3 {4 intn,m,t;5scanf ("%d",&t);6 while(t--&& scanf ("%d%d",&n,&m))7 {8printf ("%d\n", m*n* (m+1) * (n+1)/4);9 }Ten return 0; One}
View Code
Summer Camp (4) Second bounce-----recursion (hdu2254)