题库练习 Petya and Spiders
← 上一题 下一题 →

A8190 | Petya and Spiders

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Little Petya loves training spiders. Petya has a board $n×m$ in size. Each cell of the board initially has a spider sitting on it. After one second Petya chooses a certain action for each spider, and all of them humbly perform its commands. There are 5 possible commands: to stay idle or to move from current cell to some of the four side-neighboring cells (that is, one command for each of the four possible directions). Petya gives the commands so that no spider leaves the field. It is allowed for spiders to pass through each other when they crawl towards each other in opposite directions. All spiders crawl simultaneously and several spiders may end up in one cell. Petya wants to know the maximum possible number of spider-free cells after one second.

输入格式

The first line contains two space-separated integers $n$ and $m$ ( $1<=n,m<=40,n·m<=40$ ) — the board sizes.

输出格式

In the first line print the maximum number of cells without spiders.

输入输出样例

输入 #1
1 1
输出 #1
0
输入 #2
2 3
输出 #2
4
C++ 编辑器
输入
输出