好水,因为不能同时切两块,所以答案其实是确定的:n*(m-1) + n - 1;
细节参见代码:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1000000000;
const int maxn = 100000+5;
int n,m;
int main() {
while(~scanf("%d%d",&n,&m)) {
printf("%d\n",n*(m-1) + n - 1);
}
return 0;
}
解析代码:计算切割水块的数量
本文详细解析了一个计算切割水块数量的代码逻辑,通过数学公式n*(m-1)+n-1来实现,提供了清晰的代码实现和解释。
112

被折叠的 条评论
为什么被折叠?



