法1:
//#include<iostream>
#include<cstdio>
//#include<algorithm>
//#include<cmath>
//#include<string.h>
using namespace std;
int main()
{
int a,b,sum=0;
scanf("%d%d",&a,&b);
while(a!=0 && b!=0){
sum+=a*b;
a--;b--;
}
printf("%d",sum);
return 0;
}
法2:
#include<iostream>
#include<cstdio>
#include<algorithm>
//#include<cmath>
//#include<string.h>
using namespace std;
int main()
{
int a,b,sum=0;
scanf("%d%d",&a,&b);
for(int i=1;i<=min(a,b);i++){
for(int x=0;x<=a-1;x++){
for(int y=0;y<=b-1;y++)
if(x+i<=a && y+i<=b)
sum++;
}
}
printf("%d",sum);
return 0;
}