CF38C.Blinds
普及/提高-
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The blinds are known to consist of opaque horizontal stripes that can be rotated thus regulating the amount of light flowing in the room. There are n blind stripes with the width of 1 in the factory warehouse for blind production. The problem is that all of them are spare details from different orders, that is, they may not have the same length (it is even possible for them to have different lengths)
Every stripe can be cut into two or more parts. The cuttings are made perpendicularly to the side along which the length is measured. Thus the cuttings do not change the width of a stripe but each of the resulting pieces has a lesser length (the sum of which is equal to the length of the initial stripe)
After all the cuttings the blinds are constructed through consecutive joining of several parts, similar in length, along sides, along which length is measured. Also, apart from the resulting pieces an initial stripe can be used as a blind if it hasn't been cut. It is forbidden to construct blinds in any other way.
Thus, if the blinds consist of k pieces each d in length, then they are of form of a rectangle of k × d bourlemeters.
Your task is to find for what window possessing the largest possible area the blinds can be made from the given stripes if on technical grounds it is forbidden to use pieces shorter than l bourlemeter. The window is of form of a rectangle with side lengths as positive integers.
百叶窗由不透明的水平条带组成,可通过旋转调节进入房间的光线量。工厂仓库中有 n 条百叶窗条带,每条宽度均为 1。问题在于,这些条带均来自不同订单的剩余部件,因此它们的长度未必相同(甚至可能各不相同)。
每条条带均可被切割为两段或更多段。切割方向垂直于长度方向,因此切割不会改变条带的宽度,但每段所得部件的长度均小于原条带长度(且所有部件长度之和等于原条带长度)。
完成所有切割后,百叶窗通过将若干长度相等的部件沿其长度方向首尾拼接而成。此外,若某原始条带未被切割,则亦可直接用作百叶窗的一部分。禁止采用任何其他方式构造百叶窗。
因此,若百叶窗由 k 段长度均为 d 的部件构成,则其形状为 k×d 百勒米(bourlemeter)的矩形。
你的任务是:在技术限制下(即禁止使用长度小于 l 百勒米的部件),求出能用给定条带制作的、面积最大的矩形窗户的面积。该窗户为边长为正整数的矩形。
输入格式
The first output line contains two space-separated integers n and l (1 ≤ n, l ≤ 100). They are the number of stripes in the warehouse and the minimal acceptable length of a blind stripe in bourlemeters. The second line contains space-separated n integers a__i. They are the lengths of initial stripes in bourlemeters (1 ≤ a__i ≤ 100).
第一行输出包含两个用空格分隔的整数 n 和 l(1 ≤ n, l ≤ 100),分别表示仓库中条纹的数量以及百律米(bourlemeters)单位下盲条纹的最小可接受长度。
第二行包含 n 个用空格分隔的整数 ai,表示初始条纹的长度(单位:百律米)(1 ≤ ai ≤ 100)。
输出格式
Print the single number — the maximal area of the window in square bourlemeters that can be completely covered. If no window with a positive area that can be covered completely without breaking any of the given rules exist, then print the single number 0.
输出单个数字——能够被完全覆盖的窗户的最大面积(单位:平方布尔米)。如果不存在满足条件(即不违反任何给定规则)且面积为正的可完全覆盖的窗户,则输出单个数字 0。
输入输出样例
输入#1
4 2 1 2 3 4
输出#1
8
输入#2
5 3 5 5 7 3 1
输出#2
15
输入#3
2 3 1 2
输出#3
0
说明/提示
In the first sample test the required window is 2 × 4 in size and the blinds for it consist of 4 parts, each 2 bourlemeters long. One of the parts is the initial stripe with the length of 2, the other one is a part of a cut stripe with the length of 3 and the two remaining stripes are parts of a stripe with the length of 4 cut in halves.
在第一个样例测试中,所需窗户的尺寸为 2 × 4,其百叶窗由 4 部分组成,每部分长度均为 2 伯勒米特(bourlemeters)。其中一部分是初始条带,长度为 2;另一部分是从一条长度为 3 的条带中截取的部分;剩余两部分则分别来自一条长度为 4 的条带,该条带被均分为两半。
输入解题思路,AI测评打分。不知道怎么写?