hdu 3946

Philosophy Girl’s Trail

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 719    Accepted Submission(s): 208


Problem Description
  Philosophy Girl Krolia was always on the go. No one could figure out where she was. It’s said that she traveled all over the world with only two kinds of items:books and staffs.
  Krolia had a knapsack which is composed of n*m grids, and every item can be fit into grids. All the books’ size is 1*2(2*1), and the staffs’ is 1*3(3*1) and each of them can be rotated 90, 180 or 270 degrees. Every item is assigned a value and Krolia wanted to go with the maximal value.
 

Input
  The first line comes with one integer T (T=100) which denotes the test cases.
  In the first line of each case, there is four integers n (1<=n<=500), m (1<=m<=500), n1 (1<=n1<=10000) and n2 (1<=n2<=10000) which indicates the size of the knapsack, the number of the optional books and staffs. 
  The next line contains n1 integers which indicate the value bi (0<=bi<=1000) of every book. 
  The last line contains n2 integers si (0<=si<=1000) which indicate the value of every staff.
 

Output
  For each test case, output one line.
  First, output "Case #C: ", where C is the number of test case, from 1 to T. Then output the maximal value.
 

Sample Input
  
2 2 3 2 2 1 2 1 2 4 4 4 4 1 1 2 2 10 10 10 10
 

Sample Output
  
Case #1: 4 Case #2: 44
Hint
n,m,n1 and n2 <=100 in 20 cases. 50<=n,m<=500 and 1000<=n1,n2<=2000 in 50 cases. 100<=n,m<=200 and 9000<=n1,n2<=10000 in 30 cases.
 

Author
哲学少女系列@Krolia Fans Club
 

Source
 
贪心证明见:http://acm.hdu.edu.cn/discuss/problem/post/reply.php?postid=4547&messageid=1&deep=0
AC代码:
#include<algorithm>
#include<iostream>
#include<cstdio>
using namespace std;
#define maxn 10010
int m,n,n1,n2;
int mb,ms;
int b[maxn],s[maxn];
int cmp(int t1,int t2){
    return t1>t2;
}
int main(){
    int T; scanf("%d",&T);
    for(int cas=1;cas<=T;cas++){
        scanf("%d%d%d%d",&n,&m,&n1,&n2);
        s[0]=b[0]=0;
        for(int i=1;i<=n1;i++)
            scanf("%d",&b[i]);
        sort(b+1,b+1+n1,cmp);

        for(int i=1;i<=n2;i++)
            scanf("%d",&s[i]);
        sort(s+1,s+1+n2,cmp);

        for(int i=1;i<=n1;i++)
            b[i]+=b[i-1];
        for(int i=1;i<=n2;i++)
            s[i]+=s[i-1];

        if(n<=1 && m<=1){
            printf("Case #%d: 0\n",cas);
        }
        else{
            if(n>m)
                swap(n,m);
            int ans=0;
            mb=min(n1,n*m/2);

            if(n==1)
                ms=min(n2,n*m/3);
            else if(n==2 && m%3==2)
                ms=min(n2,n*m/3-1);
            else
                ms=min(n2,n*m/3);

            int msize=n*m;
            for(int i=0;i<=ms;i++){
                int tmp=0;
                int j=(msize-i*3)/2;
                tmp+=s[i];
                if(j<=mb)
                    tmp+=b[j];
                else
                    tmp+=b[mb];
                if(tmp>ans)
                    ans=tmp;
            }
            printf("Case #%d: %d\n",cas,ans);
        }
    }
    return 0;
}


【四旋翼无人机】具备螺旋桨倾斜机构的全驱动四旋翼无人机:建模与控制研究(Matlab代码、Simulink仿真实现)内容概要:本文围绕具备螺旋桨倾斜机构的全驱动四旋翼无人机展开研究,重点探讨其系统建模与控制策略,结合Matlab代码与Simulink仿真实现。文章详细分析了无人机的动力学模型,特别是引入螺旋桨倾斜机构后带来的全驱动特性,使其在姿态与位置控制上具备更强的机动性与自由度。研究涵盖了非线性系统建模、控制器设计(如PID、MPC、非线性控制等)、仿真验证及动态响应分析,旨在提升无人机在复杂环境下的稳定性和控制精度。同时,文中提供的Matlab/Simulink资源便于读者复现实验并进一步优化控制算法。; 适合人群:具备一定控制理论基础和Matlab/Simulink仿真经验的研究生、科研人员及无人机控制系统开发工程师,尤其适合从事飞行器建模与先进控制算法研究的专业人员。; 使用场景及目标:①用于全驱动四旋翼无人机的动力学建模与仿真平台搭建;②研究先进控制算法(如模型预测控制、非线性控制)在无人机系统中的应用;③支持科研论文复现、课程设计或毕业课题开发,推动无人机高机动控制技术的研究进展。; 阅读建议:建议读者结合文档提供的Matlab代码与Simulink模型,逐步实现建模与控制算法,重点关注坐标系定义、力矩分配逻辑及控制闭环的设计细节,同时可通过修改参数和添加扰动来验证系统的鲁棒性与适应性。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值