300582: CF111C. Petya and Spiders

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Petya and Spiders

题意翻译

### 题面描述 给定一个$n \times m$的棋盘,一开始每一个格子上有一只蜘蛛,你可以让每一只蜘蛛向上或下或左或右走一格,也可以让蜘蛛停在原地不懂,但前提是不能走出棋盘,可以有多只蜘蛛在同一个格子中,问最多可以空出多少个格子? ### 输入数据 一行,两个正整$n,m(1 \leq n,m \leq 40,1 \leq n \cdot m \leq 40) $ ### 输出数据 一行,一个非负整数,表示最多能空出的格子数。

题目描述

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

说明

In the first sample the only possible answer is: s In the second sample one of the possible solutions is: `<br></br>rdl<br></br>rul<br></br>`s denotes command "stay idle", l, r, d, u denote commands "crawl left", "crawl right", "crawl down", "crawl up", correspondingly.

Input

题意翻译

### 题面描述 给定一个$n \times m$的棋盘,一开始每一个格子上有一只蜘蛛,你可以让每一只蜘蛛向上或下或左或右走一格,也可以让蜘蛛停在原地不懂,但前提是不能走出棋盘,可以有多只蜘蛛在同一个格子中,问最多可以空出多少个格子? ### 输入数据 一行,两个正整$n,m(1 \leq n,m \leq 40,1 \leq n \cdot m \leq 40) $ ### 输出数据 一行,一个非负整数,表示最多能空出的格子数。

加入题单

上一题 下一题 算法标签: