QOJ.ac

QOJ

Limite de temps : 2.0 s Limite de mémoire : 1024 MB Points totaux : 100

#9824. 墙上的另一块砖

Statistiques

Alice 喜欢搭建玩具墙。她有大量的 $1 \times 2$ 砖块和有限的 $1 \times 3$ 砖块。两种砖块的高度均为 $1$,且不能旋转。

Alice 打算用这些砖块搭建一面厚度为 $1$ 个单位、长度为 $l$、高度为 $h$ 的墙。如果墙中没有任何接缝直接位于另一个接缝的正上方,则称这面墙是“稳固的”(solid)。

良好的接缝放置、糟糕的接缝放置、稳固的 $7 \times 4$ 墙

请帮助 Alice 确定搭建一面长度为 $l$、高度为 $h$ 的稳固墙体所需的最少 $1 \times 3$ 砖块数量。

输入格式

输入仅一行,包含两个整数 $l$ 和 $h$,分别表示墙的长度和高度($5 \le l \le 1000$;$2 \le h \le 1000$)。

输出格式

输出搭建一面长度为 $l$、高度为 $h$ 的稳固墙体所需的最少 $1 \times 3$ 砖块数量。

可以证明,搭建长度为 $l$、高度为 $h$ 的稳固墙体总是可能的。

样例

样例输入 1

7 4

样例输出 1

4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.