QOJ.ac

QOJ

時間限制: 0.5 s 記憶體限制: 256 MB 總分: 100 可 Hack ✓

#16774. 创新业务

统计

Chip 'n' Dale 在森林里开创了一项新业务:他们生产固定尺寸的长方形瓷砖,并用它们来铺路。

铺路的规则如下:从长方形道路的一个角开始,瓷砖并排铺设,不留缝隙,也不重叠。当且仅当整块瓷砖放不下时,才可以将其切割成碎片来铺路。每块瓷砖上都印有平行线的图案,在铺好的道路上必须保持该图案的方向。这使得它们的方向非常重要:任何瓷砖或其碎片都不能旋转。所有瓷砖的拼接线都是直的,与道路的某一条边缘平行,并且彼此之间要么垂直,要么平行。Chip 'n' Dale 总是这样铺路:每块瓷砖的每条边最多与另一块瓷砖相邻,并且他们总是以道路上瓷砖碎片数量最少的方式来铺路。

给定道路的尺寸和单块瓷砖的尺寸,请帮助 Chip 'n' Dale 确定他们需要生产多少块完整的瓷砖才能完全铺满道路。

输入格式

输入的第一行包含两个整数 $Width_{road}$ 和 $Length_{road}$($1 \le Width_{road}, Length_{road} \le 10\,000$),分别表示道路的宽度和长度。

输入的第二行包含两个整数 $Width_{tile}$ 和 $Length_{tile}$($1 \le Width_{tile} \le Width_{road}$,$1 \le Length_{tile} \le Length_{road}$),分别表示瓷砖的宽度和长度。

输出格式

输出的第一行应包含一个整数 $N$ — 根据 Chip 'n' Dale 的铺路规则,完全铺满道路所需的最少完整瓷砖数量。

样例

输入 1

10 10
2 2

输出 1

25

输入 2

3 5
2 2

输出 2

4

输入 3

35 17
25 1

输出 3

26

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.