CF50A Domino piling 题解

本文为作者原创,欢迎转载并注明原出处,如果本文对您有帮助,请您关注、评论或点赞,感谢您的支持!
本文链接: https://blog.csdn.net/kkkksc03/article/details/102526402

description:

n × m 1 × 2 给定一个n\times m的矩阵,问能放置几个1\times2的多米诺骨牌

solution:

这道题仅仅是要求放置的个数而不是方案数。

这样应该就能想到解答了:

÷ ( 1 × 2 ) 矩阵的面积算出来再\div (1\times2)就行了

n × m 2 于是就是要输出\frac{n\times m}{2}

code:

#include<cstdio>
using namespace std;
int main()
{
	int a,b;
	scanf("%d%d",&a,&b);
	printf("%d\n",a*b/2);
	return 0; 
} 

猜你喜欢

转载自blog.csdn.net/kkkksc03/article/details/102526402
今日推荐