Description
给出一个 m∗n 的区域,问最多可以放多少个 2∗1 的砖
Input
两个整数 m,n(1≤m,n≤16)
Output
输出最多可以放多少块砖
Sample Input
2 4
Sample Output
4
Solution
n,m 有一个为偶数,显然可以铺满, ans=nm2
n,m 均为奇数,显然前 n−1 列可以类似上一种方案铺满,剩下一列挨着放即可, ans=(n−1)m2+⌊m2⌋=⌊nm2⌋
故 ans=⌊nm2⌋
Code
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<ctime>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const int INF=0x3f3f3f3f,maxn=100001;
int main()
{
int n,m;
while(~scanf("%d%d",&n,&m))printf("%d\n",n*m/2);
return 0;
}