Land Division Tax - POJ 2086 dp

针对一家高端房产开发商面临的土地划分及税收问题,本篇介绍了一种通过动态规划算法来确定最优土地划分方案的方法,旨在最小化整个开发过程中的总土地划分税。

Land Division Tax
Time Limit: 5000MS Memory Limit: 30000K
Total Submissions: 699 Accepted: 308

Description

International Concrete Projects Company (ICPC) is a construction company which specializes in building houses for the high-end market. ICPC is planning a housing development for new homes around a lake. The houses will be built in lots of different sizes, but all lots will be on the lake shore. Additionally, every lot will have exactly two neighbors in the housing development: one to the left and one to the right. 

ICPC owns the land around the lake and needs to divide it into lots according to the housing development plan. However, the County Council has a curious regulation regarding land tax, intended to discourage the creation of small lots: 
  1. land can only be divided using a sequence of land divisions; 
  2. a land division is an operation that divides one piece of land into two pieces of land; and 
  3. for each land division, a land division tax must be paid.

Denoting by A the area of the largest resulting part of the division, the value of the land division tax is A*F, where F is the division tax factor set yearly by the County Council. Note that due to (2), in order to divide a piece of land into N lots, N - 1 land divisions must be performed, and therefore N - 1 payments must be made to the County Council. 
For example, considering the figure above, if the division tax factor is 2.5 and the first land division separates the lot of 500 units of area from the other lots, the land division tax to be paid for this first division is 2.5 * (300 + 200 + 100 + 100 + 100). If the next land division separates the lot of 300 units together with its neighbor lot of 100 units, from the set of the remaining lots, an additional 2.5 * (300 + 100) must be paid in taxes, and so on. Note also that some land divisions are not possible, due to (2). For example, after the first land division mentioned above, it is not possible to make a land division to separate the lot of 300 units together with the lot of 200 units from the remaining three lots, because more than two parts would result from that operation. 
Given the areas of all lots around the lake and the current value of the division tax factor, you must write a program to determine the smallest total land division tax that should be paid to divide the land according to the housing development plan.

Input

The input contains several test cases. The first line of a test case contains an integer N and a real F, indicating respectively the number of lots (1 <= N <= 200) and the land division tax factor (with precision of two decimal digits, 0 < F <= 5.00). The second line of a test case contains N integers Xi, representing the areas of contiguous lots in the development plan (0 < Xi <= 500, for 1 <= i <= N); furthermore, Xk is neighbour to Xk+1 for 1 <= k <= N - 1, and XN is neighbour to X1. The end of input is indicated by N = F = 0.

Output

For each test case in the input your program must produce a single line of output, containing the minimum total land division tax, as a real number with precision of two decimal digits.

Sample Input

4 1.50
2 1 4 1
6 2.50
300 100 500 100 100 200
0 0

Sample Output

13.50
4500.00

题意:你每次需要将一个大的区域分成两部分,每次的费用是税率*分割后的两块地中最大的面积。

思路:将环形转化成一维的,然后dp[i][j]表示分割i到j块地所需的价钱,dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+max(s[k]-s[i-1],s[j]-s[k]))。

AC代码如下:

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int dp[410][410],val[410],s[410],INF=1e9;
int main()
{ int n,N,i,j,k,len,ans;
  double p;
  while(~scanf("%d%lf",&n,&p) && n)
  { for(i=1;i<=n;i++)
    { scanf("%d",&val[i]);
      val[i+n]=val[i];
    }
    N=n*2;
    for(i=1;i<=N;i++)
    { dp[i][i]=0;
      s[i]=s[i-1]+val[i];
    }
    for(len=1;len<n;len++)
     for(i=1;i+len<=N;i++)
     { j=i+len;
       dp[i][j]=INF;
       for(k=i;k<j;k++)
        dp[i][j]=min(dp[i][j],dp[i][k]+dp[k+1][j]+max(s[k]-s[i-1],s[j]-s[k]));
     }
    ans=INF;
    for(i=1;i<=n;i++)
     ans=min(ans,dp[i][i+n-1]);
    printf("%.2f\n",ans*p);
  }
}



内容概要:本文档围绕六自由度机械臂的ANN人工神经网络设计展开,涵盖正向与逆向运动学求解、正向动力学控制,并采用拉格朗日-欧拉法推导逆向动力学方程,所有内容均通过Matlab代码实现。同时结合RRT路径规划与B样条优化技术,提升机械臂运动轨迹的合理性与平滑性。文中还涉及多种先进算法与仿真技术的应用,如状态估计中的UKF、AUKF、EKF等滤波方法,以及PINN、INN、CNN-LSTM等神经网络模型在工程问题中的建模与求解,展示了Matlab在机器人控制、智能算法与系统仿真中的强大能力。; 适合人群:具备一定Ma六自由度机械臂ANN人工神经网络设计:正向逆向运动学求解、正向动力学控制、拉格朗日-欧拉法推导逆向动力学方程(Matlab代码实现)tlab编程基础,从事机器人控制、自动化、智能制造、人工智能等相关领域的科研人员及研究生;熟悉运动学、动力学建模或对神经网络在控制系统中应用感兴趣的工程技术人员。; 使用场景及目标:①实现六自由度机械臂的精确运动学与动力学建模;②利用人工神经网络解决传统解析方法难以处理的非线性控制问题;③结合路径规划与轨迹优化提升机械臂作业效率;④掌握基于Matlab的状态估计、数据融合与智能算法仿真方法; 阅读建议:建议结合提供的Matlab代码进行实践操作,重点理解运动学建模与神经网络控制的设计流程,关注算法实现细节与仿真结果分析,同时参考文中提及的多种优化与估计方法拓展研究思路。
内容概要:本文围绕电力系统状态估计中的异常检测与分类展开,重点介绍基于Matlab代码实现的相关算法与仿真方法。文章详细阐述了在状态估计过程中如何识别和分类量测数据中的异常值,如坏数据、拓扑错误和参数误差等,采用包括残差分析、加权最小二乘法(WLS)、标准化残差检测等多种经典与现代检测手段,并结合实际算例验证方法的有效性。同时,文档提及多种状态估计算法如UKF、AUKF、EUKF等在负荷突变等动态场景下的应用,强调异常处理对提升电力系统运行可靠性与安全性的重要意义。; 适合人群:具备电力系统基础知识和一定Matlab编程能力的高校研究生、科研人员及从事电力系【状态估计】电力系统状态估计中的异常检测与分类(Matlab代码实现)统自动化相关工作的工程技术人员。; 使用场景及目标:①掌握电力系统状态估计中异常数据的产生机制与分类方法;②学习并实现主流异常检测算法,提升对状态估计鲁棒性的理解与仿真能力;③服务于科研项目、课程设计或实际工程中的数据质量分析环节; 阅读建议:建议结合文中提供的Matlab代码进行实践操作,配合电力系统状态估计的基本理论进行深入理解,重点关注异常检测流程的设计逻辑与不同算法的性能对比,宜从简单案例入手逐步过渡到复杂系统仿真。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值