int FindMatrix(int iM, int iN, int iCurM, int iCurN)
{
return (iM - iCurM + 1) * (iN - iCurN + 1);
}
int _tmain(int argc, _TCHAR* argv[])
{
int iM = 3;
int iN = 3;
int iAllMatrix = 0;
for (int i = 2; i <= iM; i++)
{
for (int j = 2; j <= iN; j++)
{
iAllMatrix += FindMatrix(iM, iN, i, j);
}
}
cout << "总矩阵数目: " << iAllMatrix << endl;
int iCurM = 2;
int iCurN = 2;
int iNumMatrix = FindMatrix(iM, iN, iCurM, iCurN);
cout << "当前矩阵数目: " << iNumMatrix << endl;
getchar();
return 0;
}
------解决方案--------------------