/ 7FOJ / 题库 /

「ACSL2016-2017 All-Star」Panels

「ACSL2016-2017 All-Star」Panels

背景

  • Idea: ACSL
  • Data: ACSL
  • Solution: ACSL
  • 题面: ACSL + oistream
  • Translate: oistream

描述

ACSL is in the process of putting decorative, padded, rectangular panels on the walls in its headquarters. Our interior designer has decided that all panels will be the same size and will be affixed according to the following algorithm:

\(\text{ACSL}\) 计划装修他们的总部,用矩形的镶板(可以理解为瓷砖——译注)铺墙。他们的设计师已经决定所有的镶板都为同一大小且按照下面的算法来铺,

  • Place the first panel at the left edge of the wall, with its vertical midpoint at the vertical midpoint of the wall. Continue placing panels to the right in the same row, until no more panels can fit. (That is, you cannot split a panel!) For example, if the wall is \(4.25\) meters wide and \(6\) meters high, the first row of \(1\)-by-\(1\) square-meter panels will consist of \(8\) panels, starting at \(3.5\) meters off the floor.

  • 将第一个镶板贴着墙的左边缘摆放,并且使它的高的中点正好位于墙高的中点。在这个板的右边依次铺上板,直到不能再铺为止 (你不能将一个镶板劈开!) 举例来说,假如墙有 \(4.25\) 米长,\(6\) 米高,我们用 \(1\times 1\) 立方米的镶板铺上的第一行会包含 \(8\) 个镶板,并且位于离地 \(3.5\) 米的高度。

  • Next, add rows of panels above the initial row, offset each row horizontally to the right by 50% of the width of one panel from the start of the previous row. Continue until no more rows can be added. And finally, add rows below the initial row, offset each by 25% of the width of one panel from the start of the previous row. Continue until no more rows can be added.

  • 接下来,在刚刚铺上的一行(称为基准行)的上面加行,每一行都相对于它下面的一行后移了一个镶板长的 \(50\%\)。重复这样直到无法再加新的一行为止。然后,再在基准行的下面加行,每一行都相对于它上面的一行后移了一个镶板长的 \(25\%\)。重复这样直到无法再加新的一行为止。

输入格式

There will be a line of input. This line will contain four numbers representing the width and height of the wall, and then the width and height of the panel to use.

输入共有一行,包含四个整数,依次是墙长,墙高,镶板长,镶板高。

输出格式

Print the number of square meters on the wall not covered by panels. Your answers must match our official answers to within one-tenth of a square meter.

输出墙 被镶板盖住的面积。你的答案(相对于标准答案的)误差不得超过 \(\dfrac{1}{10}\) 平方米。

样例

样例输入1

4.25 6 1 1

样例输出1

8.5

样例解释

样例解释1

Here’s what a \(4.25\)-by-\(6\) room would look like with panels that are 1-by-1:

下图是一个 \(4.25\times 6\) 的墙按照上述算法铺上 \(1\times 1\) 的镶板的结果。

dpmNtg.jpg

The wall is \(4.25 \times 6 = 25.5\) square meters. The panels take up \(17.0\) square meters, leaving \(8.5\) square meters uncovered.

墙的面积是 \(4.25\times 6=25.5\) 平方米。镶板盖住了 \(17.0\) 平方米,剩下 \(8.5\) 平方米未被盖住。

数据规模与约定

本题原题共五组样例,五组数据。我们选出原题样例中的一组作为本题样例。本题共有十组数据,具体情况如下表。

数据编号 时间限制 \(/\text{s}\) 空间限制 \(/\text{MB}\) 分值 \(/\text{pts}\) 限制 备注
\(\#1\) \(1\) \(128\) \(10\) 输入的所有数值均小于 \(200\) 原题样例,本题样例
\(\#2\sim \#5\) \(1\) \(128\) 每题 \(10\),共 \(40\) 输入的所有数值均小于 \(200\) 原题样例,本题数据
\(\#6\sim \#10\) \(1\) \(128\) 每题 \(10\),共 \(50\) 输入的所有数值均小于 \(200\) 原题数据,本题数据

信息

ID
1119
难度
2
分类
模拟 点击显示
标签
递交数
2
已通过
1
通过率
50%
被复制
1
上传者