UVA - 10970 Big Chocolate
题目大意:用最少的刀数让巧克力变成1X1的
解题思路:先多后少即可
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main() {
int N,M;
while (scanf("%d%d", &N, &M) != EOF) {
int s = 0;
if (N > M) {
s = N - 1;
s = s + N*(M-1);
}
else {
s = M - 1;
s = s + M*(N-1);
}
printf("%d\n", s);
}
}