ZJU-PAT 1056. Mice and Rice (25) 浙大2013年上机复试第四题

ZJU-PAT 1078. Hashing (25) 浙大2014年上机复试第二题 #include #include #include #include #include using namespace std; const int MaxN=20001; int n,m; bool Position[MaxN]; void special_process(int cur) { for(int i=1; i<m; i++) { int po 阅读详情
#pragma warning (disable:4786)
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;

int n,m;
int B[100005];

int flag;

int cnt;//第几轮次被淘汰 

int group[1005],num_in_group;

struct mice
{
	int id;
	int weight;
	bool join;
	int rounds;
	int rank;
};
mice TT[100005];

bool judge()
{
	for(int i=0;i<n;i++) 
	{
		if(TT[i].join==false) return true;
	}
	return false;
}

bool cmp(mice a,mice b)
{
	return a.rounds >b.rounds;
}


bool cmp1(mice a,mice b)
{
	return a.id<b.id;
}

void process(int num)
{
	if(flag==n-1)
	{
		TT[group[0]].rounds=cnt;
		TT[group[0]].join=true;
		return;
	}

	int _id=-1,_max=-1,i;

	for(i=0;i<num;i++)
	{
		if(TT[group[i]].weight>_max) 
		{
			_max=TT[group[i]].weight;
			_id=i;
		}
	}
	for(i=0;i<num;i++)
	{
		if(i==_id) continue;
		TT[group[i]].rounds=cnt;
		TT[group[i]].join=true;
		flag++;
	}
}


int main()
{
	while(scanf("%d%d",&n,&m)!=EOF)
	{
		int i,j;
		
		//-------input--------
		for(i=0;i<n;i++) 
		{
			scanf("%d",&TT[i].weight);
			TT[i].join=false;
			TT[i].id=i;
		}
		for(i=0;i<n;i++) scanf("%d",&B[i]);
		
		
		//------group----------
		cnt=1;
		flag=0;
		while(judge())
		{
			num_in_group=0;
			
			for(i=0;i<n;i++) 
			{
				if(TT[B[i]].join==true) continue;
				group[num_in_group++]=B[i];
				
				if(num_in_group==m) 
				{
					process(num_in_group);
					num_in_group=0;
				}
			}
			if(num_in_group) process(num_in_group);
			cnt++;
		}

		//-------output----------
		sort(TT,TT+n,cmp);
		TT[0].rank=1;

		for(i=1;i<n;i++)
		{
			if(TT[i].rounds==TT[i-1].rounds)
				TT[i].rank=TT[i-1].rank;
			else TT[i].rank=i+1;
		}
		sort(TT,TT+n,cmp1);

		for(i=0;i<n;i++)
		{
			if(i!=n-1)
				printf("%d ",TT[i].rank);
			else
				printf("%d\n",TT[i].rank);
		}
	}
	return 0;
}

【电力负荷预测】项目介绍 MATLAB实现基于BO-Transformer-LSTM贝叶斯优化算法(BO)优化Transformer-LSTM组合模型进行居民用户多步电力负荷预测(含模型描述及部分示例 内容概要:本文介绍了一个基于BO-Transformer-LSTM的组合模型,用于实现居民用户多步电力负荷预测的完整项目实例。该模型融合Transformer的全局注意力机制与LSTM的局部时序记忆能力,构建能够捕捉长时依赖与周期性特征的深度学习架构,并引入贝叶斯优化(BO)自动搜索最优超参数组合,提升预测精度与训练效率。项目涵盖从原始数据清洗、特征工程、滑动窗口样本构建、模型设计到超参数优化、反归一化及多步误差评估的全流程,强调时间顺序划分以防止信息泄露,并通过周期编码、外生变量融合等方式增强数据表达能力。文中提供了详细的MATLAB代码示例,包括数据预处理、网络搭建、贝叶斯优化配置和预测结果评估等关键步骤。 适合人群:具备一定机器学习和时间序列分析基础,熟悉MATLAB编程环境,从事电力系统预测、智能电网、负荷管理等相关领域的研究人员、工程师及研究生。 使用场景及目标:①应用于居民级或多用户聚合负荷的短期至中期多步预测(如未来24小时);②服务于配电系统运行调度、需求响应基线设定、家庭能源管理系统优化、分布式能源协调控制等实际工程场景;③为科研提供可复现的深度学习+贝叶斯优化的技术路线参考。 阅读建议:此资源以实际项目为导向,建议读者结合提供的代码逐步实现并调试模型,重点关注数据质量控制、时间特征编码、组合网络结构设计与贝叶斯优化稳定性之间的协同关系,在实践中深入理解多步预测中的误差累积机制与超参数敏感性问题。 立即下载

相关推荐

国央企创新负责人如何通过平台实现科研成果的快速识别与转化?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

PAT1056.Mice and Rice (25)

题目地址:http://pat.zju.edu.cn/contests/pat-a-practise/1056 这题为浙大2013年考研复试上机的倒数第二题,分值为25分。此题得分率很低。 在考试之后,很多考生反映,题目读不懂。 读不懂应该是源于sample input中的第三行。第三行的序列给出的是依次要进行比较的老鼠的编号。 Sample Input: 11 3 25 18 0 4

eli850934234的专栏 1793

PotPlayer自用皮肤

自用 PotPlayer 皮肤,仅微调了字体大小与颜色,是按个人习惯调整,未做适配性调整。

ZJU-PAT 1010. Radix (25)

Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is a binary number. Now for any pair of positive

Matrix_Reloaded的专栏 4799

2-shell及常用命令-续.pdf

2-shell及常用命令-续.pdf

inferCNV包安装问题及解决办法

InferCNV是一个由broad研究所开发的,利用单细胞转录组数据分析肿瘤细胞拷贝数变异(CNV)的工具。基本思路是在整个基因组范围内,通过计算肿瘤细胞关于参考的“正常”细胞的相对表达,利用滑窗思想对邻近的基因相对表达,计算拷贝数。 先贴一个官方安装说明: 官方infercnv安装说明 安装infercnv包: if (!requireNamespace("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager:

m0_51042606的博客 6803

ZJU-PAT 1065. A+B and C (64bit) (20)

Given three integers A, B and C in [-263, 263], you are supposed to tell whether A+B > C. Input Specification: The first line of the input gives the positive number of test cases, T ( Output

Matrix_Reloaded的专栏 3966

均值场博弈_平均场博弈(mean field game)

The New Big Fish Called Mean-Field Game Theory原文链接http://www.science4all.org/article/mean-field-games/​www.science4all.org主要内容在经典博弈论中,它对附近其他鱼类的行为做出反应。这是非常复杂的,因为不同的鱼类之间会有大量的相互作用。这意味着经典博弈论对应于一长串高度耦合的方程。...

weixin_34773479的博客 3681

ZJU-PAT 1080. Graduate Admission (30) 浙大2014年上机复试第四题

#include #include #include #include using namespace std; const int maxn=40005; const int maxm=101; int n,m,k; int num[maxm]; int lastRank[maxm]; vector mm[maxm]; struct stu { int id; int G

Matrix_Reloaded的专栏 2509

Simulink玩转PMSM无感FOC:从IF强拖参数调试到切换失败的避坑指南

本文深入探讨了Simulink在PMSM无感FOC控制中的IF强拖启动参数调试与切换避坑技巧。通过详细解析强拖加速、速度维持和闭环切换三大阶段的设计逻辑,以及五个常见陷阱的解决方案,帮助工程师快速定位启动失败和切换震荡问题。文章还提供了典型故障的波形诊断方法和高级调试工具链优化建议,是电机控制领域的实用指南。

weixin_29164843的博客 408

Notion卡顿救星:3分钟搞定DNS优化,手机电脑全平台加速指南

本文针对Notion访问慢和卡顿问题,提供了全平台DNS优化与Hosts文件修改的详细指南。通过更换优质DNS服务器或建立静态IP映射,可有效解决因网络延迟和域名解析导致的加载缓慢,实现手机与电脑端的快速加速,提升Notion使用流畅度。

v6b7n8m9q0的博客 1306

ZJU-PAT 1079. Total Sales of Supply Chain (25) 浙大2014年上机复试第三题

#include #include using namespace std; struct Node { int parent; //父节点 bool flag; //是否是retailers int level; //第几层 int num; //销售多少个 }; Node tt[100005]; int n; double p,r,sum;

Matrix_Reloaded的专栏 2205

从ROS2到ROS1:Lightning-LM激光SLAM模块的移植实践与核心代码解析

本文详细解析了将高性能激光SLAM算法Lightning-LM从ROS2移植到ROS1的完整实践过程。针对ROS1与ROS2在节点初始化、话题通信、参数服务器及TF发布等核心API的差异,文章提供了loc_system和slam模块的核心代码改造示例,并给出了适配catkin的CMakeLists.txt与package.xml配置方案,帮助开发者在现有ROS1生态中高效集成先进的SLAM模块。

weixin_29224529的博客 172

ZJU-PAT 1057. Stack (30) 浙大2013年上机复试第三题

#pragma warning (disable:4786) #include #include #include #include #include using namespace std; int n,d;; int A[10005],B[10005]; int select(int num) { for(int i=1;i<=d;i++) B[i]=A[i];

Matrix_Reloaded的专栏 1921

【企业智能体开发】优化模型成本、延迟与失败降级

小林的培训快开始时,服务台花很久“思考最优回答”,体验并不会更好。反过来,为了省钱而始终选最轻的模型,若连房间、连接方式和任务状态都识别不稳,后续错误检索和重复建单会造成更大代价。企业 Agent 的优化对象不是单次模型调用价格,而是任务在可接受时间内、安全地推进到正确结果的总成本。

Mr数据杨 893

手把手教你学PCIE(11.3)--pcie的认证和合规性测试

PCIe 设备的认证和合规性测试是确保设备正常工作和达到预期性能的关键步骤。通过使用 PCI-SIG 提供的测试工具和第三方测试工具,可以全面评估 PCIe 设备的物理层、链路层、事务层和互操作性,确保设备符合行业标准和规范。

MHD0815的博客 1359

ZJU-PAT 1070. Mooncake (25)

Mooncake is a Chinese bakery product traditionally eaten during the Mid-Autumn Festival. Many types of fillings and crusts can be found in traditional mooncakes according to the region's culture. Now

Matrix_Reloaded的专栏 1892

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

ZJU-PAT 1081. Rational Sum (20)

模拟题 #pragma warning (disable:4786) #include #include #include #include #include #include #include using namespace std; long long int sum,ans,sum1; int n; struct Node { long long int numerato

Matrix_Reloaded的专栏 1708

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

ZJU-PAT 1054. The Dominant Color (20) 浙大2013年上机复试第一题

#pragma warning (disable:4786) #include #include #include #include using namespace std; int main() { int m,n; while(scanf("%d%d",&m,&n)!=EOF) { int i,j; string s; map ans;

Matrix_Reloaded的专栏 1612

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

ZJU-PAT 1077. Kuchiguse (20) 浙大2014年上机复试第一题

#include #include #include #include using namespace std; string longest_common_suffix(string a,string b) { string tmp=""; int len1=a.size()-1; int len2=b.size()-1; while(len1>=0 && len2>=0) {

Matrix_Reloaded的专栏 1413

ZJU-PAT 1055. The World's Richest (25) 浙大2013年上机复试第二题

#pragma warning (disable:4786) #include #include #include #include #include using namespace std; int m,n; int num,Min,Max; struct people { string name; int age,money; }; people TT[

Matrix_Reloaded的专栏 1339

ZJU PAT 1012 The Best Rank

#include #include #include #include using namespace std; #define Min(a,b)(a<b?a:b) int n,m; struct student { int id,ctest,math,english; double avg; int crank,mrank,erank,arank; int bestrank; st

Matrix_Reloaded的专栏 1003

ZJU-PAT 1050

#include #include using namespace std; /* Sample Input: They are students. aeiou Sample Output: Thy r stdnts. */ bool myhash[150]; string s1,s2; void run() { getline(cin,s2); int i; string

Matrix_Reloaded的专栏 923

ZJU-PAT 1051 Pop Sequence

#include #include #include using namespace std; int m,n,cases; stack f; int a[1005]; bool Judge() { while(f.empty()==false) f.pop(); int i,j; for(i=0;i<n;i++) scanf("%d",&a[i]); if(a[0]>m) re

Matrix_Reloaded的专栏 787
上一篇: ZJU-PAT 1057. Stack (30) 浙大2013年上机复试第三题
下一篇: Android工程import进workspace常见问题
Matrix_Reloaded
博客等级 码龄14年 18粉丝 36原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值