21569_Landscaping

2022-5-16 18:19| 发布者: Hocassian| 查看: 35| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505649188900-Problem List-采集的数据-后羿采集器.html

Pro.ID

21569

Title

Landscaping

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21569

AC

1

Submit

3

Ratio

33.33%

时间&空间限制

  • Time Limit: 1000/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Farmer John is building a nicely-landscaped garden, and needs to move a large amount of dirt in the process.

    The garden consists of a sequence of N flowerbeds (1 ≤ N ≤ 100), where flowerbed i initially contains Ai units of dirt.  Farmer John would like to re-landscape the garden so that each flowerbed i instead contains Bi units of dirt.  The Ai's and Bi's are all integers in the range 0..10.

    To landscape the garden, Farmer John has several options: he can purchase one unit of dirt and place it in a flowerbed of his choice for $X.  He can remove one unit of dirt from a flowerbed of his choice and have it shipped away for $Y.  He can also transport one unit of dirt from flowerbed i to flowerbed j at a cost of $Z times |i-j|.  Please compute the minimum total cost for Farmer John to complete his landscaping project.

    输入

    多测试。

    * Line 1: Space-separated integers N, X, Y, and Z (0 ≤ X, Y, Z ≤ 1000).

    * Lines 2..1+N: Line i+1 contains the space-separated integers Ai and Bi.

    输出

    Description

    Farmer John is building a nicely-landscaped garden, and needs to move a large amount of dirt in the process.

    The garden consists of a sequence of N flowerbeds (1 ≤ N ≤ 100), where flowerbed i initially contains Ai units of dirt.  Farmer John would like to re-landscape the garden so that each flowerbed i instead contains Bi units of dirt.  The Ai's and Bi's are all integers in the range 0..10.

    To landscape the garden, Farmer John has several options: he can purchase one unit of dirt and place it in a flowerbed of his choice for $X.  He can remove one unit of dirt from a flowerbed of his choice and have it shipped away for $Y.  He can also transport one unit of dirt from flowerbed i to flowerbed j at a cost of $Z times |i-j|.  Please compute the minimum total cost for Farmer John to complete his landscaping project.

    Input

    多测试。

    * Line 1: Space-separated integers N, X, Y, and Z (0 ≤ X, Y, Z ≤ 1000).

    * Lines 2..1+N: Line i+1 contains the space-separated integers Ai and Bi.

    Output

    * Line 1: A single integer giving the minimum cost for Farmer John's landscaping project.

    Sample Input

    4 100 200 1
    1 4
    2 3
    3 2
    4 0

    Sample Output

    210

    Hint

    INPUT DETAILS:

    There are 4 flowerbeds in a row, initially with 1, 2, 3, and 4 units of dirt. Farmer John wishes to transform them so they have 4, 3, 2, and 0 units of dirt, respectively.  The costs for adding, removing, and transporting dirt are 100, 200, and 1.

    OUTPUT DETAILS:

    One unit of dirt must be removed (from flowerbed #4), at a cost of 200.  The remaining dirt can be moved at a cost of 10 (3 units from flowerbed #4 to flowerbed #1, 1 unit from flowerbed #3 to flowerbed #2).

    Source

    样例输入

    4 100 200 1
    1 4
    2 3
    3 2
    4 0

    样例输出

    210

    提示

    INPUT DETAILS:

    There are 4 flowerbeds in a row, initially with 1, 2, 3, and 4 units of dirt. Farmer John wishes to transform them so they have 4, 3, 2, and 0 units of dirt, respectively.  The costs for adding, removing, and transporting dirt are 100, 200, and 1.

    OUTPUT DETAILS:

    One unit of dirt must be removed (from flowerbed #4), at a cost of 200.  The remaining dirt can be moved at a cost of 10 (3 units from flowerbed #4 to flowerbed #1, 1 unit from flowerbed #3 to flowerbed #2).


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部