DIV250

Problem Statement
    
You have 16 bricks. Each brick has the shape of a rectangular box. You are given a vector <int> height. For each i, one of your bricks has dimensions 1 x 1 x height[i].
 你有十六块砖头,每块砖头都是矩形的。你会得到一个int类的砖头高度。根据对应的i,砖头将被切割为1*1*height【i】
You also have an opaque table. You are going to place your 16 bricks onto the table in a specific way. You are not allowed to rotate the bricks while placing them: the dimension given in height must always be vertical. On the table, there is a 4 x 4 grid of squares. You have to place exactly one of your bricks onto each of the squares.
 你还有一个不透明的层,你将用一种特定的方式放置你的16块砖在平面层。放你放置砖块的时候,你不能旋转它们,高度必须是垂直的。平面层里是4*4的网格方块。你必须把你的砖头放进每个网格方块里。
After you place all the bricks, we will look at the solid formed by them. We are interested in the visible surface area of the solid. Note that the bottom sides of your bricks are not a part of the visible surface, as they stand on the table. Also, adjacent bricks always touch each other and the parts where they touch are not visible.
 记住,你的砖头底面立在平面上是不可见的.此外,砖头之间的相邻面也是不可见的。
Different arrangements of bricks may lead to different visible surfaces. Return the largest possible visible surface area.
不同的砖块排序可能导致不同的显见面,输出最大可能的显见面面积。

Definition
    
Class:
SixteenBricks
Method:
maximumSurface
Parameters:
vector <int>
Returns:
int
Method signature:
int maximumSurface(vector <int> height)
(be sure your method is public)
Limits
    
Time limit (s):
2.000
Memory limit (MB):
256
Constraints
-
height will contain exactly 16 elements.
-
Each element of height will be between 1 and 100, inclusive.
Examples
0)

    
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
Returns: 32
All your bricks look the same. The only solid you can construct is a 1 x 4 x 4 box. The bottom side of the box is not visible, the other five sides are. The total visible surface area is 4*4 + 4*(1*4) = 32.
1)

    
{1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2}
Returns: 64
In order to maximize the visible surface area, you should produce a configuration in which no two bricks with height 2 share a common face.
2)

    
{77, 78, 58, 34, 30, 20, 8, 71, 37, 74, 21, 45, 39, 16, 4, 59}
Returns: 1798

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2003, TopCoder, Inc. All rights reserved.

题目

英语是硬伤- -翻译成中文才能开始做

时间: 2024-11-06 12:35:55

DIV250的相关文章