这题方法很简单,但是要注意数据类型要用longlong,题目中给出了是64bit的
1 #include<iostream> 2 using namespace std; 3 int main(){ 4 long a,b,temp=1; 5 while(cin>>a>>b){ 6 if(!a&&!b) 7 break; 8 long long sum=1; 9 if(a<2||b<2){ 10 cout<<"Case "<<temp++<<": 0"<<endl; 11 continue; 12 } 13 sum*=(a-1)*a; 14 sum*=(b-1)*b; 15 sum/=4; 16 cout<<"Case "<<temp++<<": "<<sum<<endl;; 17 } 18 }