@ Water Title: seeking the number of square rectangular #include <cstdio> #include <the cstdlib> the using namespace STD; int n-, m; const int N = 103 ; int CNT1 [N] [N], CNT2 [N] [ N]; int main () { Scanf ( " % D% D " , & n-, & m); for ( int I = . 1 ; I <= n-; I ++ ) for ( int J = . 1 ; J <= m; J ++ ) { CNT1 [I] [J] = CNT1 [I- . 1 ] [J] CNT1 + [I] [J-1] -cnt1[i-1][j-1]; cnt2[i][j]=cnt2[i-1][j]+cnt2[i][j-1] -cnt2[i-1][j-1]; for(int k=1;k<=i && k<=j;k++) cnt1[i][j]++; cnt2[i][j]+=i*j; } printf("%d %d",cnt1[n][m],cnt2[n][m]-cnt1[n][m]); return 0; }