10532 - 窗体面积

你刚刚接手一项窗体界面工程。窗体界面还算简单,而且幸运的是,你不必显示实际的窗体。有 5 种基本操作:

创建一个新窗体 将窗体置顶 将窗体置底 删除一个窗体 输出窗体可见部分的百分比(就是,不被其它窗体覆盖的部分)。 在输入文件中,操作以如下的格式出现。

创建一个新窗体:w(I,x,y,X,Y) 将窗体置顶: t(I) 将窗体置底: b(I) 删除一个窗体:d(I) 输出窗体可见部分的百分比:s(I) I 是每个窗体唯一的标识符。表示符可以是 'a'..'z', 'A'..'Z' 和 '0'..'9' 中的任何一个。输入文件中没有多余的空格。 (x,y)和(X,Y)是窗体的对角。当你创建一个窗体的时候,它自动被“置顶”。你不能用已经存在的标识符来创建窗体,但是你可以删除一个窗体后再用已 删除窗体的标识符来创建窗体。坐标用正整数来表示,并且所有的窗体面积都不为 0(x <> X 且 y <> Y)。x 坐标和 y 坐标在 1 —— 32767 的范围内。

输入

输入文件包含给你的解释程序的一系列命令,每行一个。当输入文件结束时,停止程序。

输出

只对于 s() 命令进行输出。当然,输入文件可能有许多 s() 命令,所以输出文件应该是一个百分比的序列,每行一个,百分比是窗体可见部分的百分比。百分比应该四舍五入到三位小数。

样例

输入

w(a,10,132,20,12)
w(b,8,76,124,15)
s(a)

输出

49.167

提示

Window Area IV Balkan Olympiad You've just be assigned the project of implemented a windowing interface. This windowing interface is fairly simple, and fortunately, you don't have to display the actual windows. There are 5 basic operations:

Create a window Bring a window to the top Put a window to the bottom Destroy a window Output what percentage of a window is visible (i.e., isn't covered by windows above it). In the input, the operations appear in the following format:

Create window: w(I,x,y,X,Y) Bring window to top: t(I) Put window on bottom: b(I) Destroy window: d(I) Output percentage visible: s(I) The I is a unique identifier for each window, which is one character. The character can be any of 'a'..'z', 'A'..'Z', and '0'..'9'. No extra spaces will appear in the input. (x,y) and (X,Y) are opposite corners of the window. When a window is created, it is put `on top'. You can't create a window with an identifier that is already in use, but you can destroy a window and then create a new one with the identifier of the destroyed window. Coordinates will be positive integers, and all windows will be of non-zero area (x != X and y != Y). The x and y coordinates are between 1 and 32767 inclusive.

PROGRAM NAME: window INPUT FORMAT The input file consists of a sequence of commands to your interpreter. They will be listed one per line. Terminate the program when no more input is available

SAMPLE INPUT (file window.in) w(a,10,132,20,12) w(b,8,76,124,15) s(a)

OUTPUT FORMAT Output lines only for the s() commands. Of course, there might be several s() commands (but no more than 500) so the output should be a sequence of percentages, one per line, stating the percentage of the windows that are visible. The percentages should be rounded to 3 decimal places.

SAMPLE OUTPUT (file window.out) 49.167

时间限制 1 秒
内存限制 128 MB
讨论 统计
上一题 下一题