http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1911
思路很简单。把大块m行n列的巧克力的切成1为宽度,长度为m的小块,这样是n-1刀,然后有n个这样的小块,每个再这么切,每个需要m-1刀。
#include <iostream>
using namespace std;
int main()
{
int n,m;
while(cin>>n>>m)
{
cout<<n*(m-1) + n-1 <<endl;
}
}