贪心基础题-----结构体简单应用

Problem Description
As this term is going to end, DRD needs to prepare for his final exams.

DRD has n exams. They are all hard, but their difficulties are different. DRD will spend at least ri hours on the i-th course before its exam starts, or he will fail it. The i-th course's exam will take place ei hours later from now, and it will last for li hours. When DRD takes an exam, he must devote himself to this exam and cannot (p)review any courses. Note that DRD can review for discontinuous time.

So he wonder whether he can pass all of his courses.

No two exams will collide.
 

Input
First line: an positive integer T20 indicating the number of test cases.
There are T cases following. In each case, the first line contains an positive integer n105, and n lines follow. In each of these lines, there are 3 integers ri,ei,li, where 0ri,ei,li109.

 

Output
For each test case: output ''Case #x: ans'' (without quotes), where x is the number of test cases, and ans is ''YES'' (without quotes) if DRD can pass all the courses, and otherwise ''NO'' (without quotes).

 

Sample Input
2 3 3 2 2 5 100 2 7 1000 2 3 3 10 2 5 100 2 7 1000 2
 

Sample Output
Case #1: NO Case #2: YES 题意大致是某同学考试,有n门课要复习,第i门课要花费ri小时复习,第i门课会在ei小时后开考并持续li小时,问能否所有课程都复习完 输入第一行代表机组测试实例,第二行代表课程数n,接下来n行代表n门课,n行中的每一行依次是 需要复习的时间ri 此门课在ei小时后开考 持续li小时 理解题意就好做了
#include<cstdio>
#include<algorithm>
using namespace std;
struct lu{// 定义结构体,成员包括三个int型变量
    int m, n, k;
}kaoshi[100001];
int cmp(lu a, lu b){//  定义sort排序的标准,按照结构体元素n的大小排序
    return a.n < b.n;
}
int main()
{
    int a, b, kcase = 1;
    scanf("%d", &a);
    while(a--)
    {
        scanf("%d", &b);
        for(int i = 0; i < b; i++){
            scanf("%d%d%d", &kaoshi[i].m, &kaoshi[i].n, &kaoshi[i].k);
        }
        int ok = 0;
        sort(kaoshi, kaoshi + b, cmp);//   按上边定义的标准排序
        long long ju = kaoshi[0].m;
        for(int i = 0; i < b; i++){
            if(kaoshi[i].n - ju < 0){//   有一门距离考试时间与需要复习时间差值小于0则肯定不能完成
                ok = 1;
                break;
            }
            ju = kaoshi[i+1].m + kaoshi[i].k + kaoshi[i].n;//  本门课距离开考时间加上考试持续时间加上下门课复习时间 与下门课距开考时间继续比较
        }
        printf("Case #%d: ", kcase++);
        printf(!ok ? "YES\n" : "NO\n");//  这个运算符用着停方便
    }
    return 0;
}


内容概要:本文围绕可变桨叶四旋翼无人机的规范控制与点对点运动模拟展开,重点研究优化推力分配策略在翻转动作中的应用与性能比较。通过Matlab代码实现,构建了四旋翼动力学模型,并设计了多种控制算法以实现精确的姿态调整与轨迹跟踪。研究对比了不同推力分配方案在执行高机动性翻转动作时的稳定性、能耗效率与响应速度,旨在提升无人机在复杂飞行任务中的动态性能与控制精度。该仿真研究为无人机飞控系统的设计与优化提供了理论依据和技术支持。; 适合人群:具备一定自动控制理论基础和Matlab编程能力,从事无人机控制、飞行器动力学或机器人系统研究的科研人员及研究生。; 使用场景及目标:① 实现四旋翼无人机在三维空间中的精确点对点运动控制;② 对比分析不同推力分配策略在执行翻转等高难度动作时的控制效果与能耗表现,优化飞行性能;③ 为无人机自主飞行、特技飞行及复杂环境下的机动控制提供算法验证平台。; 阅读建议:此资源以Matlab仿真为核心,建议读者结合相关控制理论知识,深入理解代码实现细节,重点关注动力学建模、控制律设计与推力分配模块。在学习过程中,应动手调试参数,复现文中翻转动作的仿真结果,并尝试拓展至其他复杂飞行任务,以加深对无人机控制机理的理解。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值