#P12105. [NWRRC2024] Another Brick in the Wall

[NWRRC2024] Another Brick in the Wall

题目描述

Alice likes building toy walls. She has a lot of 1×21 \times 2 bricks and a limited supply of 1×31 \times 3 bricks. Both types of bricks have a height of 1 and can not be rotated.

Alice is going to build a one unit thick wall of length ll and height hh out of these bricks. A wall is solid\textit{solid} if there are no seams directly above another seam.

Help Alice determine the minimum number of 1×31 \times 3 bricks required to build a solid wall of length ll and height hh.

输入格式

The only line contains two integers ll and hh, denoting the length and the height of the wall (5l10005 \le l \le 1000; 2h10002 \le h \le 1000).

输出格式

Print the minimum number of 1×31 \times 3 bricks required to build a solid l×hl \times h wall.

It can be shown that it is always possible to build a solid wall of length ll and height hh.

7 4
4