540 - Team Queue***

队列与队列操作的高效实现
//提交未成功 #include <iostream> #include <string> #include <cstdio> #include <sstream> using namespace std; const int nMax=1005; struct Queue{ int q[nMax]; int front,rear; Queue():front(0),rear(0){} }queue[nMax]; struct Team{ int t[nMax]; int n;//n表示元素个数 Team():n(0){} }team[nMax]; int t,n; int getTeam(int x) { for(int i=0;i<n;i++) { for(int j=0;j<team[i].n;j++) if(team[i].t[j]==x) return i; } return -1; } void EnQueue(int u,int a) { queue[u].q[queue[u].front++]=a; } int DeQueue() { for(int i=0;i<n;i++) { for(int j=queue[i].rear;j<queue[i].front;j++) { return queue[i].q[queue[i].rear++]; } } return -1; } int main() { /* freopen("data.in","r",stdin); freopen("data.out","w",stdout); //*/ int cas=0; while(scanf("%d",&t) && t!=0) { cas++; printf("Scenario #%d\n",cas); for(int i=0;i<t;i++) { scanf("%d",&n); team[i].n=n; for(int j=0;j<n;j++) scanf("%d",&team[i].t[j]); } string command; while(getline(cin,command) && command!="STOP") { istringstream in(command); string oper; in>>oper; if(oper=="ENQUEUE") { int a; in>>a; int u; u=getTeam(a); EnQueue(u,a); } else if(oper=="DEQUEUE") { int a=DeQueue(); if(a!=-1) printf("%d\n",a); } } printf("\n"); } return 0; }
#include <iostream> #include <cstdio> #include <string> #include <list> using namespace std; list<int> l; int elem[1000000];//暴力求解--思想 list<int>::iterator team[1005]; int t,n; int main() { //freopen("data.in","r",stdin); int cas=0; while(scanf("%d",&t) && t) { printf("Scenario #%d\n",++cas); l.clear(); for(int i=1;i<=t;i++) { team[i]=l.end(); int n; scanf("%d",&n); for(int j=0;j<n;j++) { int a; scanf("%d",&a); elem[a]=i; } } string oper; while(cin>>oper && oper!="STOP") { if(oper=="ENQUEUE") { int b; scanf("%d",&b); if(team[elem[b]]!=l.end()) { ++team[elem[b]]; team[elem[b]]=l.insert(team[elem[b]],b); } else team[elem[b]]=l.insert(team[elem[b]],b); } else if(oper=="DEQUEUE") { int temp; temp=l.front(); if(team[elem[temp]]==l.begin())//漏写 team[elem[temp]]=l.end(); printf("%d\n",temp); l.pop_front(); } } printf("\n"); } return 0; }

/* * Copyright (c) 2006-2021, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2022-09-21 baijinhui the first version */ #include "app_actuator.h" #if (ACTUATOR_TYPE == 25) #include <rtthread.h> #include <rtdevice.h> #include "board.h" #include <stdio.h> #include "bsp_can.h" #include "app_location.h" #include "app_chassis.h" #include "lib_inc.h" #include "app_chassis_fork.h" #include "app_qrps.h" #define DBG_TAG "actuator" #define DBG_LVL DBG_LOG #include <ulog.h> /*-------------------------外部引用-------------------------*/ /*-------------------------公共变量-------------------------*/ /*-------------------------局部变量-------------------------*/ #define Pi 3.14159265359f static struct msg_actuator_status msg1; static struct msg_actuator_ctrl msg2; static struct msg_actuator_para msg3; static struct msg_qrps_status qrpsMsg1; static struct msg_location_status locationMsg1; static struct msg_chassis_ctrl chassisMsg2; static struct msg_chassis_para chassisMsg3; static struct msg_chassis_fork_status forkMsg1; static struct msg_chassis_fork_ctrl forkMsg2; static struct rt_messagequeue mq_actuatorDriver; static char msg_pool_actuatorDriver[128]; struct rx_actuatorDriver { unsigned short int id; unsigned char cmd; unsigned short int index; unsigned char sub_index; unsigned char dat[4]; }; static unsigned int actStatus[3] = { 0 }; // 动作执行状态 static unsigned int timeCount[3] = { 0 }; //动作执行计时 static unsigned int hightNeedCal = 1; //高度需要校准 0不需要 1需要 static unsigned int slideNeedCal = 1; //横移需要校准 0不需要 1需要 static unsigned int locBiasError = 0; //上装定位偏差错误 /*-------------------------函数实现-------------------------*/ void app_actuator_status(struct msg_actuator_status *status) { RT_ASSERT(status != RT_NULL); rt_memcpy(status, &msg1, sizeof(msg1)); } void app_actuator_ctrl(struct msg_actuator_ctrl *ctrl) { RT_ASSERT(ctrl != RT_NULL); rt_memcp
03-13
基于数据驱动的 Koopman 算子的递归神经网络模型线性化,用于纳米定位系统的预测控制研究(Matlab代码实现)内容概要:本文围绕“基于数据驱动的Koopman算子的递归神经网络模型线性化”展开,旨在研究纳米定位系统的预测控制方法。通过结合数据驱动技术与Koopman算子理论,将非线性系统动态近似为高维线性系统,进而利用递归神经网络(RNN)建模并实现系统行为的精确预测。文中详细阐述了模型构建流程、线性化策略及在预测控制中的集成应用,并提供了完整的Matlab代码实现,便于科研人员复现实验、优化算法并拓展至其他精密控制系统。该方法有效提升了纳米级定位系统的控制精度与动态响应性能。; 适合人群:具备自动控制、机器学习或信号处理背景,熟悉Matlab编程,从事精密仪器控制、智能制造或先进控制算法研究的研究生、科研人员及工程技术人员。; 使用场景及目标:①实现非线性动态系统的数据驱动线性化建模;②提升纳米定位平台的轨迹跟踪与预测控制性能;③为高精度控制系统提供可复现的Koopman-RNN融合解决方案; 阅读建议:建议结合Matlab代码逐段理解算法实现细节,重点关注Koopman观测矩阵构造、RNN训练流程与模型预测控制器(MPC)的集成方式,鼓励在实际硬件平台上验证并调整参数以适应具体应用场景。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值