Number of rectangles
Description
In a 3*2 rectangle, you can find 6 1*1 and 4 2*1 and 3 1*2 Rectangles and 2 2*2 and 2 3*1 and 1 3*2 rectangle, A total of 18 rectangles.
Returns A and B, and calculates the number of rectangles that can be found.
Input
There are multiple groups of input data (<10000) in this question. You must process the EOF.
Enter two integers A, B (1 <= A, B <= 2000)
Output
Output The number of rectangles.
Sample Input
1 2
2 3
Sample output
3
18
#include <iostream>#include <cstring>#include <cstdio>#include <algorithm>using namespace std;int main(){ long long n,m,sum; while(cin>>n>>m) { sum=0; for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) { sum+=i*j; } cout<<sum<<endl; } return 0;}
Number of rectangles in C Language
I don't know what the author means by saying "Yes is wrong.
I used VC ++ 6.0 to copy the landlord's code and compile and run it.
Test cases:
2 3
18
4 5
150
6 7
588
Which of the following is the number of Rectangles?
45, 48, 57
72, 95