手把手教数据结构与算法:优先级队列(银行排队问题)

队列

基本概念

队列的定义

队列(Queue):队列是一种常见的数据结构,遵循先进先出(First-In-First-Out, FIFO)的原则。在队列中,元素按照进入队列的顺序排列。队列是一个线性的数据结构,并且这个数据结构只允许在一端进行插入,另一端进行删除,禁止直接访问除这两端以外的一切数据。


队首(Front):最先进入队列的元素,可以被访问或移除
队尾(Rear):最后进入队列的元素,不允许进行访问和删除的另一端。
空队列:不含任何元素的队列。

队列的特点

队列是一种先进先出(First in First out,FIFO)的数据类型。每次元素的入队都只能添加到队列尾部,出队时从队列头部开始出。

队列的常见基本操作

  1. 入队(Enqueue):将新元素添加到队列的末尾(队尾)。

  2. 出队(Dequeue):移除队列中的第一个元素(队首)。

  3. 获取队首元素(Front):获取队列中的第一个元素,但不将其从队列中移除。

  4. 获取队列大小(Size):获取队列中当前元素的数量。

  5. 检查队列是否为空(IsEmpty):检查队列中是否有元素。

优先级队列

上文已经提到了队列先进先出的特点,而优先级队列不满足先进先出的条件,更像是数据类型中的“堆”。

入队(Enqueue):优先级队列入队时会根据优先级来考虑哪个元素先入队,优先级可以通过元素的大小等进行定义。比如定义元素越大优先级越高,则元素大的先入队。

出队(Dequeue):优先级队列每次出队的元素是队列中优先级最高的那个元素,而不是队首的元素。比如定义元素越大优先级越高,那么每次出队,都是将当前队列中最大的那个元素出队。

队列通常用于模拟排队的场景,如任务调度、消息传递等。在计算机科学中,队列也是广泛应用的一种数据结构,在算法设计和实现中发挥着重要作用。所以下面让我们动手实现一个优先级队列,用来模拟银行排队问题

队列的应用

银行排队问题

题目描述

假设银行有 K 个柜台,所有顾客按到达时间排队,当有柜台空闲,队伍最前面的顾客前往空闲柜台处理事务,求顾客的平均排队时间(排队时间=到空闲柜台开始处理事务时间-到达时间)。

提示

用优先级队列实现,并且以到达时间和服务时间作为数组输入

输入

第一行输入柜台个数≥1——int 型;
第二行输入顾客个数≥1——int 型;
第三行输入每位顾客的到达时间≥0——int 型数组,默认升序。
第四行输入每位顾客的服务时间≥0——int 型数组;

输出

第一行输出顾客的平均排队时间——int 型,向下取整。

样例输入

1

10

0 1 2 3 4 5 6 7 8 9

10 10 10 10 10 10 10 10 10 10

样例输出

40

解题思路

该问题要求模拟银行顾客排队的过程,通过输入柜台数、顾客数、每位顾客的到达时间和服务时间,模拟了顾客在银行排队办理业务的过程,计算顾客的平均排队时间。解题思路如下:

  1. 创建优先级队列:使用优先级队列来模拟顾客的排队情况。队列中的元素按到达时间排序,即到达时间越早的顾客排在队列前面。这样,在柜台空闲时,就可以直接从队列头部取出顾客进行服务。

  2. 初始化:读取输入的柜台个数、顾客个数、到达时间数组和服务时间数组。将顾客的到达时间和对应的服务时间插入到优先级队列中。

  3. 模拟排队过程:开始模拟银行排队的过程,直到所有顾客都被服务完毕为止。在每个时间点,检查是否有柜台空闲,如果有,则从队列中取出最早到达的顾客进行服务,计算其排队时间并累加到总的排队时间中。

  4. 计算平均排队时间:将总的排队时间除以顾客总数,即可得到平均排队时间,向下取整并输出结果

代码实现

结点类(node)

首先是队列的结点设计,可以设计出两个结构体,一个结构体 Node 表示结点,其中包含有 data 域和 next 指针,如下图:


其中 data 表示数据,其可以是简单的类型,也可以是复杂的结构体,故采用泛型编程template<typename eT>。next 指针表示,下一个的指针,其指向下一个结点,通过 next 指针将各个结点链接。结点类还有构造函数,在创建结点时可以进行初始化,

template<typename eT>
class node {
public:
	eT data;
	node* next;
	node(const eT& data_, node<eT>* next_ = NULL)
	{
		data = data_;
		next = next_;
	}
	node() : next(NULL) {}
	~node() {}
};
自定义队列(linkQueue)

自定义队列linkQueue采用泛型编程,其中 eT 是模板参数,代表队列中元素的类型。

front 和 tail 分别是指向队列前端和尾端的指针,用于操作队列中的元素。

构造函数和析构函数

构造函数用于初始化队列,将 front 和 tail 初始化为 NULL,表示队列为空。

析构函数用于释放队列中所有节点的内存。它通过循环遍历队列中的所有节点,逐个删除节点,并更新 front 指针,直到队列为空。

成员函数 isEmpty

isEmpty函数用于检查队列是否为空,如果front指针为空,则队列为空,返回true,否则返回false

成员函数 enQueue

enQueue 函数用于向队列尾部添加一个新元素。如果队列为空(即 tail 为空),则创建一个新节点,将 front 和 tail 都指向该节点。如果队列非空,则在 tail 指向的节点后面添加一个新节点,并更新 tail 指针。

成员函数 deQueue

deQueue 函数用于从队列头部移除一个元素,并返回其值。

首先保存队列头部节点的指针 tmp,并保存头部节点的值到 value 中。

然后更新 front 指针,指向原头部节点的下一个节点。如果队列只有一个节点(即移除后为空),则将 tail 也置为空。

最后释放原头部节点的内存,并返回其值。

template<typename eT>
class linkQueue{
public:
	node<eT>* front, * tail;
public:
	linkQueue() { front = tail = NULL; }
	~linkQueue() {
		node<eT>* tmp;
		while (front != NULL) {
			tmp = front;
			front = front->next;
			delete tmp;
		}
	}
	bool isEmpty() { return front == NULL; }
	void enQueue(const eT& x) {
		if (tail == NULL)
			front = tail = new node<eT>(x);
		else {
			tail->next = new node<eT>(x);
			tail = tail->next;
		}
	}
	eT deQueue() {
		node<eT>* tmp = front;
		eT value = front->data;
		front = front->next;
		if (front == NULL) tail = NULL;
		delete tmp;
		return value;
	}
};
优先级队列(priorityQueue)

与自定义队列(linkQueue)相同,采用泛型编程,其中 eT 是模板参数,代表队列中元素的类型。front 和 tail 分别是指向队列前端和尾端的指针,用于操作队列中的元素。

同样地,优先级队列(priorityQueue)与自定义队列(linkQueue)的初始化,判断非空,出队操作基本相同,主要不同点在于入队操作。

成员函数 enQueue

enQueue 函数用于向队列尾部添加一个新元素。如果队列为空(即 tail 为空),则创建一个新节点,将 front 和 tail 都指向该节点。如果队列非空,则寻找较大元素的前继结点进行插入操作,以保持队列的有序性。

template <typename eT>
class priorityQueue {
public:
	node<eT>* front, * tail;
	priorityQueue() { front = tail = NULL; }
	~priorityQueue() {
		node<eT>* tmp;
		while (front != NULL) {
			tmp = front;
			front = front->next;
			delete tmp;
		}
	}
	bool isEmpty() { return front == NULL; }
	eT deQueue() {
		node<eT>* tmp = front;
		eT value = front->data;
		front = front->next;
		if (front == NULL) tail = NULL;
		delete tmp;
		return value;
	}
	void enQueue(const eT& x) {
		if (tail == NULL)
			front = tail = new node<eT>(x);
		else {
			node<eT>* p;
			if (x < front->data)
			{
				p = new node<eT>(x, front);  front = p;
			}
			else {
				p = front;
				while (p->next != NULL && p->next->data < x) p = p->next;
				if (p->next == NULL)
				{
					tail->next = new node<eT>(x);
					tail = tail->next;
				}
				else  p->next = new node<eT>(x, p->next);
			}
		}
	}
};

模拟银行排队系统(simulator)

成员变量

1.noOfServer:表示银行柜台的数量。

2.customNum:表示顾客的数量。

3.arrivalTimeList:存储每位顾客到达银行的时间。

4.serviceTimeList:存储每位顾客所需的服务时间。

内部结构体 eventT

1.用于描述事件,包括事件发生时间 time 和事件类型 type(0 表示到达,1 表示离开)。

2.重载了小于操作符,以便将事件按照发生时间进行排序。

class simulator {
		int noOfServer;
		int customNum;
		int* arrivalTimeList;
		int* serviceTimeList;
		struct eventT
		{
			int time; //事件发生时间
			int type; //事件类型。0 为到达,1 为离开
			bool operator<(const eventT& e) const { return time < e.time; }
		};
};
构造函数和析构函数

构造函数从标准输入中读取柜台数、顾客数以及每位顾客的到达时间和服务时间,然后分配内存给 arrivalTimeList 和 serviceTimeList,分别用这两个数组储存每位顾客的到达时间和服务时间

析构函数释放动态分配的内存,防止内存泄漏

public:
		simulator() {
			//std::cout << "请输入柜台数:";
			std::cin >> noOfServer;
			//std::cout << "请输入模拟的顾客数:";
			std::cin >> customNum;
			arrivalTimeList = new int[customNum];
			serviceTimeList = new int[customNum];
			for (int i = 0; i < customNum; i++) {
				std::cin >> arrivalTimeList[i];
			}
			for (int i = 0; i < customNum; i++) {
				std::cin >> serviceTimeList[i];
			}
		}
		~simulator() {
			delete arrivalTimeList;
			delete serviceTimeList;
		}
成员函数avgWaitTime

该函数用来模拟顾客排队,到达和离开的过程,并且计算出平均等待时间。在该函数中我们需要用自定义队列(linkQueue)来存储等待的顾客事件和顾客的服务时间,并且用优先级队列(priorityQueue)存储顾客到达和离开的事件。

1.定义变量并进行初始化

变量表示的内容已注释

int serverBusy = 0; // 记录当前服务中的柜台数量
int serviceTime = 0; // 记录当前服务所需时间
int currentTime = 0; // 记录当前时间
int totalWaitTime = 0; // 记录总的等待时间
linkQueue<eventT> waitQueue; // 等待队列,存储等待的顾客事件
priorityQueue<eventT> customerQueue; // 顾客队列,存储到达和离开的顾客事件
linkQueue<int> serviceTimeQueue; // 服务时间队列,存储顾客的服务时间
eventT currentEvent; // 当前事件
2.生成初始事件队列
for (int i = 0; i < customNum; ++i) {
    currentEvent.type = 0;
    currentTime = arrivalTimeList[i]; // 每个顾客的到达时刻
    currentEvent.time = currentTime;
    customerQueue.enQueue(currentEvent); // 将顾客到达事件加入到顾客队列中
    serviceTimeQueue.enQueue(serviceTimeList[i]); // 将顾客的服务时间加入到服务时间队列中
}
3.模拟顾客到达和离开的过程

(1)用while循环不断取出顾客队列,直到顾客队列为空,即所有顾客都已经离开银行。从顾客队列中取出事件,并将其赋值给 currentEvent,将当前时间更新为当前事件的发生时间,即顾客到达或离开的时间。

(2)根据事件类型进行处理

a.顾客到达

如果有空闲的柜台,则顾客直接前往柜台处理业务,将当前事件的结束时间继续存入顾客队列,即顾客离开;如果所有柜台都忙碌,则顾客加入等待队列。

b.顾客离开

如果等待队列不为空,则从等待队列中取出顾客,并计算顾客等待的时间;如果等待队列为空,则只需更新柜台的繁忙状态。

while (!customerQueue.isEmpty()) {
    currentEvent = customerQueue.deQueue(); // 取出顾客队列中的事件
    currentTime = currentEvent.time; // 更新当前时间
    switch (currentEvent.type) {
        case 0: // 顾客到达事件
            if (serverBusy < noOfServer) { // 如果有空闲的柜台
                serverBusy++;
                currentEvent.time = currentTime + serviceTimeQueue.deQueue(); // 计算顾客服务结束时间
                currentEvent.type = 1; // 设置事件类型为离开
                customerQueue.enQueue(currentEvent); // 将离开事件加入到顾客队列中
            } else { // 如果所有柜台都忙碌
                waitQueue.enQueue(currentEvent); // 将顾客加入等待队列
            }
            break;
        case 1: // 顾客离开事件
            if (!waitQueue.isEmpty()) { // 如果等待队列不为空
                serverBusy--;
                currentEvent = waitQueue.deQueue(); // 取出等待队列中的顾客事件
                totalWaitTime += currentTime - currentEvent.time; // 计算等待时间
                currentEvent.time = currentTime + serviceTimeQueue.deQueue(); // 计算顾客服务结束时间
                currentEvent.type = 1; // 设置事件类型为离开
                customerQueue.enQueue(currentEvent); // 将离开事件加入到顾客队列中
            } else {
                serverBusy--;
            }
            break;
        default:
            break;
    }
}
4.返回平均等待时间
return totalWaitTime / customNum; // 返回平均等待时间

完整代码

#include<iostream>
#include<stdlib.h>
#include<queue>
using namespace std;
template<typename eT>
class node {
public:
	eT data;
	node* next;
	node(const eT& data_, node<eT>* next_ = NULL)
	{
		data = data_;
		next = next_;
	}
	node() : next(NULL) {}
	~node() {}
};
template<typename eT>
class linkQueue{
public:
	node<eT>* front, * tail;
public:
	linkQueue() { front = tail = NULL; }
	~linkQueue() {
		node<eT>* tmp;
		while (front != NULL) {
			tmp = front;
			front = front->next;
			delete tmp;
		}
	}
	bool isEmpty() { return front == NULL; }
	void enQueue(const eT& x) {
		if (tail == NULL)
			front = tail = new node<eT>(x);
		else {
			tail->next = new node<eT>(x);
			tail = tail->next;
		}
	}
	eT deQueue() {
		node<eT>* tmp = front;
		eT value = front->data;
		front = front->next;
		if (front == NULL) tail = NULL;
		delete tmp;
		return value;
	}
};
template <typename eT>
class priorityQueue {
public:
	node<eT>* front, * tail;
	priorityQueue() { front = tail = NULL; }
	~priorityQueue() {
		node<eT>* tmp;
		while (front != NULL) {
			tmp = front;
			front = front->next;
			delete tmp;
		}
	}
	bool isEmpty() { return front == NULL; }
	eT deQueue() {
		node<eT>* tmp = front;
		eT value = front->data;
		front = front->next;
		if (front == NULL) tail = NULL;
		delete tmp;
		return value;
	}
	void enQueue(const eT& x) {
		if (tail == NULL)
			front = tail = new node<eT>(x);
		else {
			node<eT>* p;
			if (x < front->data)
			{
				p = new node<eT>(x, front);  front = p;
			}
			else {
				p = front;
				while (p->next != NULL && p->next->data < x) p = p->next;
				if (p->next == NULL)
				{
					tail->next = new node<eT>(x);
					tail = tail->next;
				}
				else  p->next = new node<eT>(x, p->next);
			}
		}
	}
};
class simulator {
		int noOfServer;
		int customNum;
		int* arrivalTimeList;
		int* serviceTimeList;
		struct eventT
		{
			int time; //事件发生时间
			int type; //事件类型。0 为到达,1 为离开
			bool operator<(const eventT& e) const { return time < e.time; }
		};
	public:
		simulator() {
			//std::cout << "请输入柜台数:";
			std::cin >> noOfServer;
			//std::cout << "请输入模拟的顾客数:";
			std::cin >> customNum;
			arrivalTimeList = new int[customNum];
			serviceTimeList = new int[customNum];
			for (int i = 0; i < customNum; i++) {
				std::cin >> arrivalTimeList[i];
			}
			for (int i = 0; i < customNum; i++) {
				std::cin >> serviceTimeList[i];
			}
		}
		~simulator() {
			delete arrivalTimeList;
			delete serviceTimeList;
		}
		int avgWaitTime() {
			int serverBusy = 0;
			int serviceTime = 0;
			int currentTime = 0;
			int totalWaitTime = 0;
			linkQueue<eventT> waitQueue;
			priorityQueue<eventT> customerQueue;
			linkQueue<int> serviceTimeQueue;
			eventT currentEvent;
			//生成初始的事件队列
			int i;
			for (i = 0; i < customNum; ++i)
			{
				currentEvent.type = 0;
				currentTime = arrivalTimeList[i];//每个顾客的到达时刻
				currentEvent.time = currentTime;
				customerQueue.enQueue(currentEvent);
				serviceTimeQueue.enQueue(serviceTimeList[i]);//每个顾客的服务时间
			}
			while (!customerQueue.isEmpty())
			{
				currentEvent = customerQueue.deQueue();
				currentTime = currentEvent.time;
				switch (currentEvent.type)
				{
				case 0:					
					if (serverBusy < noOfServer)
					{
						serverBusy++;
						currentEvent.time = currentTime + serviceTimeQueue.deQueue();
						currentEvent.type = 1;
						customerQueue.enQueue(currentEvent);
					}
					else {
						waitQueue.enQueue(currentEvent);
					}
					break;
				case 1:
				{
					if (waitQueue.isEmpty() == 0)
					{
						serverBusy--;
						currentEvent = waitQueue.deQueue();
						totalWaitTime = totalWaitTime + currentTime - currentEvent.time;
						currentEvent.time = currentTime + serviceTimeQueue.deQueue();
						currentEvent.type = 1;
						customerQueue.enQueue(currentEvent);
					}
					else serverBusy--;
					break;
				}
				default:break;
				}
			}
			return totalWaitTime / customNum;
		}
	};
	int main()
	{
		simulator sim;
		cout << sim.avgWaitTime() <<endl;
		return 0;
	}

附录

分类专栏

链接:

​​​​​手把手教数据结构与算法

本专栏上一节

链接:

手把手教数据结构与算法:栈的应用(平衡符号和简单计算器)-CSDN博客

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/586946.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

深入解析yolov5,为什么算法都是基于yolov5做改进的?(一)

YOLOv5简介 YOLOv5是一种单阶段目标检测算法&#xff0c;它在YOLOv4的基础上引入了多项改进&#xff0c;显著提升了检测的速度和精度。YOLOv5的设计哲学是简洁高效&#xff0c;它有四个版本&#xff1a;YOLOv5s、YOLOv5m、YOLOv5l、YOLOv5x&#xff0c;分别对应不同的模型大小…

深度学习从入门到精通——词向量介绍及应用

词向量介绍 词向量&#xff08;Word embedding&#xff09;&#xff0c;即把词语表示成实数向量。“好”的词向量能体现词语直接的相近关系。词向量已经被证明可以提高NLP任务的性能&#xff0c;例如语法分析和情感分析。词向量与词嵌入技术的提出是为了解决onehot的缺陷。它把…

pytorch中创建maskrcnn模型

0.模型输入/输出参数参见 链接: pytorch的mask-rcnn的模型参数解释 核心代码 GeneralizedRCNN(这里以mask-rcnn来解释说明) # 通过输入图像获取fpn特征图,注意这里的backbone不是直接的resnet,而是fpn化后的 features self.backbone(images.tensors) # 由于是mask-rcnn,故而…

如何快速搭建nginx服务

华子目录 nginx简介概念特点nginx框架nginx关键工作机制 nginx正向代理功能nginx反向代理功能nginx反向代理的工作流程代理本质 nginx负载均衡部署nginx常用命令systemctl系列nginx自带命令 nginx配置文件主配置文件/etc/nginx/nginx.conf内容结构模块分析配置分析注意示例 ngi…

Android创建快捷方式到桌面

效果图 参考 https://blog.51cto.com/u_16175498/8811197https://blog.51cto.com/u_16175498/8811197 权限 <uses-permission android:name"com.android.launcher.permission.INSTALL_SHORTCUT" /> 实现 if (Build.VERSION.SDK_INT > Build.VERSION_C…

【已解决】Python Selenium chromedriver Pycharm闪退的问题

概要 根据不同的业务场景需求&#xff0c;有时我们难免会使用程序来打开浏览器进行访问。本文在pycharm中使用selenium打开chromedriver出现闪退问题&#xff0c;根据不断尝试&#xff0c;最终找到的问题根本是版本问题。 代码如下 # (1) 导入selenium from selenium import …

C++ stack、queue以及deque

1、stack和queue常用接口 严格来说栈和队列的实现是容器适配器 1、常用接口&#xff1a; 栈&#xff1a;top、push、pop、size、emptystack - C Reference (cplusplus.com) 队列&#xff1a;top、push、pop、swap、size、emptyqueue - C Reference (cplusplus.com) 2、deque&a…

Android手势识别面试问题及回答

问题 1: 如何在Android中实现基本的手势识别&#xff1f; 答案: 在Android中&#xff0c;可以通过使用GestureDetector类来实现基本的手势识别。首先需要创建一个GestureDetector的实例&#xff0c;并实现GestureDetector.OnGestureListener接口来响应各种手势事件&#xff0c…

ubuntu安装mysql时候修改root密码

前情&#xff1a; 使用set password for rootlocalhost ‘passwd’&#xff1b; set password for ‘root’‘localhost’‘passwd’&#xff1b; update user set passwordpassword(‘passwd’) where user‘root’ and host ‘localhost’; flush privileges; 以上方法均报…

定制开发AI智能名片商城小程序:玩转积分制度的成功案例

在数字化浪潮席卷而来的今天&#xff0c;企业营销方式不断创新&#xff0c;力求在众多竞争对手中脱颖而出。其中&#xff0c;积分制度以其直观、有效的特点&#xff0c;成为了众多企业的营销利器。某时尚品牌“潮流前线”便是其中的佼佼者。他们通过定制一款AI智能名片商城小程…

德国著名自动化公司Festo设计了一款仿生蜜蜂,仅重34g,支持多只蜜蜂编队飞行!...

德国著名的气动元件研发及自动化解决方案供应商Festo公司近日展示了一款仿生蜜蜂&#xff08;BionicBee&#xff09;&#xff0c;重量只有34g&#xff0c;却完全可以实现自主飞行&#xff0c;还支持多只相同的蜜蜂机器人编队飞行。 BionicBee 重约 34 克&#xff0c;长 22 厘米…

二叉树的前序,中序,后序遍历

二叉树可以分为左子树&#xff0c;右子树和根节点。同时左子树和右子树又可以分为新的左子树和右子树加上新的根节点&#xff0c;以此类推。 二叉树的前序&#xff0c;中序&#xff0c;后序遍历也叫前根遍历&#xff0c;中根遍历&#xff0c;后根遍历或者前序遍历&#xff0c;…

【Vue 2.x】学习vue之三路由

文章目录 Vue三路由第十章1、vue中的路由vue的应用分为a、多页面应用b、单页面应用 2、路由的基本应用1、基础2、使用3、加载 3、vue组件的分类1、普通组件2、路由组件 4、路由的嵌套5、路由传递Query参数1、拼接参数传递2、路由传递对象 6、简化路由1、命名路由 7、parms传递参…

控制台主机不能运行,切换终端实现RPG运行

鄙人转载&#xff0c;主要是移植过程中使用小熊猫C2.25.1 过程中&#xff0c;字符集不同&#xff0c;导致某些空格 从bilibili专栏粘贴导致出现符号不匹配&#xff0c;但是编辑器不能替换 用原来的devc 5.11 发现问题&#xff0c;读出额外的英文&#xff1f; 使用文件替换&…

C语言贪吃蛇项目

今天给大家带来一款简单的贪吃蛇游戏&#xff0c;一起随我来看看吧 游戏效果&#xff1a; 实现基本的功能&#xff1a; • 贪吃蛇地图绘制 • 蛇吃⻝物的功能&#xff1a;&#xff08;上、下、左、右⽅向键控制蛇的动作&#xff09; • 蛇撞墙死亡 • 蛇撞⾃⾝死亡 • 计算得分…

5.C++动态内存管理(超全)

目录 1 .C/C 内存分布 2. C语言中动态内存管理方式&#xff1a;malloc/calloc/realloc/free 3. C内存管理方式 3.1 new/delete操作内置类型 3.2 new和delete操作自定义类型 3.3 operator new函数 3.4 定位new表达式(placement-new) &#xff08;了解&#xff09; 4. 常…

【ARMv8/v9 系统寄存 3 -- system counter CNTPCT_EL0】

文章目录 ARMv8/v9 system countersystem counter读取函数实现 ARMv8/v9 system counter 所有使用Arm处理器的系统中都会包含一个标准化的通用定时器&#xff08;Generic Timer&#xff09;框架。这个通用定时器系统提供了一个系统计数器&#xff08;System Counter&#xff0…

ps科研常用操作,制作模式图 扣取想要的内容元素photoshop

复制想要copy的图片&#xff0c; 打开ps---file-----new &#xff0c;ctrolv粘贴图片进入ps 选择魔棒工具&#xff0c;点击想要去除的白色区域 然后&#xff0c;cotrol shift i&#xff0c;反选&#xff0c; ctrol shiftj复制&#xff0c;复制成功之后&#xff0c;一定要改…

UnityWebGL获取话筒实时数据

看了木子李大佬的数字人https://digital.lkz.fit/之后&#xff0c;我也想搞一个&#xff0c;于是开始研究起来&#xff0c;先从WebGL录音开始&#xff0c;一共试了三个插件&#xff0c;个个都有问题…… 1、UnityWebGLMicrophone 用起来没啥问题&#xff0c;但是只能录音&#…

大型企业总分支多区域数据传输,效率为先还是安全为先?

大型企业为了业务拓展需要&#xff0c;会在全国乃至全球各地设立分公司和办事机构&#xff0c;以便更好地处理当地事务&#xff0c;并进行市场的开拓和客户维护&#xff0c;此时&#xff0c;企业内部就衍生出了新的业务需求&#xff0c;即多区域数据传输。 多区域很难准确定义&…
最新文章