ZJU-PAT 1055. The World's Richest (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 阅读详情
<pre name="code" class="plain">对每个年龄人数进行控制减少遍历的范围  极大降低时间复杂度<pre name="code" class="cpp">
#pragma warning (disable:4786)
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;

const int MAXN=100005;
int m,n;
int num,Min,Max;

struct people
{
	string name;
	int age,money;
};
people TT[MAXN],Valid[MAXN];
int Age[MAXN];
int Validcnt;

bool cmp(people a,people b)
{
	if(a.money!=b.money)
		return a.money>b.money;
	else if(a.age!=b.age)
		return a.age<b.age;
	else
		return a.name<b.name;
}

void output(int cases)
{
	int cnt=0;
	
	printf("Case #%d:\n",cases);
	for(int i=0;i<Validcnt && cnt<num;i++)
	{
		if(Valid[i].age>=Min && Valid[i].age<=Max)
		{
			printf("%s %d %d\n",Valid[i].name.c_str(),Valid[i].age,Valid[i].money);
			cnt++;
		}
	}
	if(cnt==0)
		printf("None\n");
}

int main()
{
	while(scanf("%d%d",&n,&m)!=EOF)
	{
		int i;
		for(i=0;i<n;i++)
		{
			char name[1000];
			scanf("%s",name);
			scanf("%d",&TT[i].age);
			scanf("%d",&TT[i].money);
			TT[i].name=name;
		}
		sort(TT,TT+n,cmp);

		//排序后对人进行筛选,每个年龄只取前100名
		Validcnt=0;
		for(i=0;i<n;i++)
		{
			if(Age[TT[i].age]<100)
			{
				Age[TT[i].age]++;
				Valid[Validcnt++]=TT[i];
			}
		}
		
		for(i=0;i<m;i++)
		{
			scanf("%d\n",&num);
			scanf("%d",&Min);
			scanf("%d",&Max);
			output(i+1);
		}
	 }
	return 0;
}




        
基于MATLAB的太阳能光伏电力仿真,模拟每日太阳能发电,可视化功率曲线,并通过数值积分计算总能量输出。.zip 1.版本:matlab2014a/2019b/2024b 2.附赠案例数据可直接运行。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。 立即下载

相关推荐

【电力负荷预测】项目介绍 MATLAB实现基于BO-Transformer-LSTM贝叶斯优化算法(BO)优化Transformer-LSTM组合模型进行居民用户多步电力负荷预测(含模型描述及部分示例

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

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

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

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

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

PotPlayer自用皮肤

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

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

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

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

西瓜书第二章——模型评估与选择(十折交叉验证/查准查全F1)

第二章——模型评估与选择

xsddys的博客 953

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

从轻量化到高精度:3DXML 转 STP 的工程数据升级技术指南

本文详细解析了3DXML转STP格式的工程数据升级技术,对比了两种格式在轻量化和高精度方面的特性差异,并提供了CATIA、FreeCAD及Python编程等多种专业级转换方案。通过实际案例展示了如何确保转换过程中的数据精度,适用于CAD设计、精密制造等场景,帮助工程师实现工程数据的高效升级。

weixin_29201859的博客 215

rk3588 rkaiq_3A_server 无法解析json文件记录

rk3588 rkaiq_3A_server 无法解析json文件记录

neardi_dev的博客 1万+

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

(8)机器人动力学

机器人是一个具有多输入多输出的复杂动力学系统,存在严重的非线性,需要非常系统的方法对机器人进行动力学研究。常用的机器人动力学建模方法有:Lagrange(拉格朗日)动力学方法、Newton-Euler(牛顿-欧拉)动力学方法、Gauss(高斯)动力学方法、Kane(凯恩)动力学方法等。机器人动力学研究的是机器人的运动和作用力之间的关系。机器人的动力学问题包括动力学正问题和动力学逆问题。动力学正问题是对于给定的关节驱动力......

rouyu308的博客 9498

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

常学常新:《Attention Is All You Need》万字解读!

常学常新:《Attention Is All You Need》万字解读!

hunteritself的博客 3648

2026华为OD机考双机位C卷++ 双机位B卷 + 双机位A卷 + 2025C/B/A卷+ 往年真题 - 题库目录分值说明 + 考点说明+在线OJ

2025华为OD机考双机位C卷++ 双机位B卷 + 双机位A卷 + 2025C/B/A卷+ 往年真题 - 题库目录分值说明 + 考点说明+在线OJ

算法大师! 5万+

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

【2026年华为秋招(AI)-2月4日-第一题(100分)- 选择题】(题目+思路+Java&C++&Python解析+在线测试)

本文摘要:本文包含20道选择题,涵盖机器学习、线性代数、Transformer架构、概率统计等多个领域。题目涉及正交矩阵性质、Transformer注意力机制、聚类距离度量、ReAct框架、Softmax函数、混淆矩阵计算、Flash-Attention优化、位置编码、期望计算、归一化方法、矩阵迭代法、矩阵秩、大模型架构、神经网络推理、泊松流性质、SVM核函数以及聚类算法等知识点。每道题均提供解析,帮助理解核心概念和解题思路。

m0_73659489的博客 125

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

Python爬虫实战:高效爬取华尔街日报文章的技术与代码详解

在当今信息爆炸的时代,金融数据和分析对于投资者、研究人员和企业决策者来说至关重要。华尔街日报(WSJ)作为全球最具影响力的财经媒体之一,其文章内容具有极高的价值。本文将详细介绍如何使用Python最新技术构建一个高效、稳定的华尔街日报文章爬虫,涵盖从基础到高级的各种技术要点。本文详细介绍了如何使用Python最新技术构建一个高效、稳定的华尔街日报文章爬虫。我们从基础爬虫实现开始,逐步添加了高级功能如分布式处理、反反爬虫策略、数据清洗和存储等。异步处理:使用asyncio和httpx实现高性能网络请求。

2201_76125261的博客 385

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

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

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

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

#pragma warning (disable:4786) #include #include #include #include #include #include using namespace std; int n,m; int B[100005]; int flag; int cnt;//第几轮次被淘汰 int group[1005],num_i

Matrix_Reloaded的专栏 1337

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

温度PID控制PLC程序

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

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 1054. The Dominant Color (20) 浙大2013年上机复试第一题
下一篇: ZJU-PAT 1057. Stack (30) 浙大2013年上机复试第三题
Matrix_Reloaded
博客等级 码龄14年 18粉丝 36原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值