You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
452 B

2 years ago
#include<iostream>
using namespace std;
long long n, m, rec, sqr;
int main() {
cin >> n >> m;
for (int i = 0; i < n; i++)//循环从n-0到n-(n-1)
for (int j = 0; j < m; j++) {//循环从m-0到m-(m-1)
if (i == j) sqr += (n - i) * (m - j);//如果i==j说明是正方形
else rec += (n - i) * (m - j);//如果不等说明是矩形
}
cout << sqr << " " << rec << endl;//输出
return 0;
}