A1012(25)

多尺度变换(Multidimensional Scaling ,MDS)详解 介绍多尺度变换基本原理 阅读详情

坑点,开数组一定要开在外面啊,要不会出现段错误,看晴神代码可能需要注意这点
技巧点,利用单独的数组记录下对应id下的四个值分别是多少,这样可以省去查找的麻烦,输出的时候也可以设置单独数组,记录下当前这个排名是哪一项的,晴神的算法已经很简洁啦,这个题不难就是做起来有些复杂

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;

int now;
struct Stu
{
	int id;
	int score[4];
}stu[2010];
bool cmp(Stu a,Stu b)
{
	return a.score[now]>b.score[now];
}
char course[4]={'A','C','M','E'};
int Rank[10000000][4]={0};

int main(){
   int n,m;
	cin>>n>>m;
	for (int i=0;i<n;i++)
	{
		scanf("%d %d %d %d",&stu[i].id,&stu[i].score[1],&stu[i].score[2],&stu[i].score[3]);
		stu[i].score[0]=stu[i].score[1]+stu[i].score[2]+stu[i].score[3];
	}
	for (now=0;now<4;now++)
	{
		sort(stu,stu+n,cmp);
		Rank[stu[0].id][now]=1;
		int r=2;
		for (int i=1;i<n;i++)
		{
			if (stu[i].score[now]==stu[i-1].score[now])
			Rank[stu[i].id][now]=Rank[stu[i-1].id][now];
			else
			Rank[stu[i].id][now]=r;
			r++;
		}
	}
	for (int i=0;i<m;i++)
	{
		int name;
		scanf("%d",&name);
		if (Rank[name][0]==0)
		printf("N/A");
		else
		{
			int minans=n+1,ans;
			for (int j=0;j<4;j++)
			{
				if (Rank[name][j]<minans)
				{
					minans=Rank[name][j];
					ans=j;
				}
			}
			printf("%d %c\n",minans,course[ans]);
		}
	}
	
    return 0;
}

此处再贴上一位大佬的写法,我一开始也是这个思路,但是因为最后一步查找id觉得太麻烦就没有继续写下去了,其实是可以采用数组方式来计算这个值的,这也告诉我们数组是很重要的
https://blog.youkuaiyun.com/phoenix_wei/article/details/79218984

【AI大模型应用开发】3.2 RAG实战 - RAG应用+UI实现加载本地文件并对话 前面我们实现了RAG基本流程,今天我们在此基础上给它加个UI界面,在浏览器打开,实现上传本地文件、解析,并用大模型实现与该文档的对话。也就是一个阉割版demo版的ChatPDF或知识库对话系统。 阅读详情

相关推荐

CST新手必看:共面波导色散曲线绘制全流程(附参数设置详解)

本文为CST新手提供了绘制共面波导色散曲线的完整流程与参数设置详解。从模型搭建、周期性边界条件设置,到本征模求解器配置和参数扫描技巧,逐步解析关键步骤,并分享后处理与结果验证方法,帮助用户高效完成仿真任务。

j0k1l2m3n的博客 425

PATA-1012-The Best Rank (25)

题意: 有N个学生M组查询 N行: 学生编号, 三组成绩 M行:查询编号M的学生,最好的成绩排第几 注意四组不同的学科有先后关系 思路: 数据辣么小,暴力! #include #include #include using namespace std; const int maxn=1000000; int num[maxn]; int c[maxn]; int m[max

GameRoad 365

初识数据结构之入门必懂——线性表(顺序表)

本文将介绍数据结构中的线性表与线性表中最简单的结构——顺序表

m0_64705485的博客 905

PAT A1012

还是一道比较简单的排序题;这里示例代码里有几个特别值得借鉴的几个点;当出现多个序列排序时,可以定义一个标志量,对相应相同坐标下的量进行排序;例如下面的cmp函数: int now;//当前第几门课 bool cmp(student a,student b){ return a.grade[now]&gt;b.grade[now];...

weixin_34273479的博客 205

temu登录接口逆向分析(含Py纯算)

【代码】temu登录接口逆向分析(含Py纯算)

数据精灵喵 1948

IEC61850 通信协议测试验证实战指南:从理论到实践

本文提供了一份全面的IEC61850通信协议测试验证实战指南,强调测试必须从理论走向工程实践。文章详细讲解了如何搭建测试环境,并深入剖析了MMS、GOOSE、SV三大核心协议的实战测试方法,旨在帮助工程师通过系统化的测试验证,确保电力自动化设备的互操作性与通信可靠性。

weixin_29204121的博客 171

1012. The Best Rank (25)暴力枚举 排序

1012. The Best Rank (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To evaluate the performance of our first year CS majored stu

qwesde 664

基于MYD-YT153与AD7616的16通道高速ADC采集系统实战指南

在嵌入式系统与工业数据采集领域,模拟信号采集是连接物理世界与数字系统的关键技术。其核心原理是通过模数转换器(ADC)将连续的模拟电压信号转换为离散的数字码值,供处理器处理。这项技术的价值在于实现了对温度、压力、振动等关键物理量的精确感知与数字化,是工业自动化、设备监测、科学实验等场景的基石。本文聚焦于**多通道**、**高精度**采集这一常见需求,深入剖析如何利用全志T153处理器的LocalBus并行总线接口,高效驱动ADI的16位、16通道同步采样ADC芯片AD7616,构建一个稳定可靠的高速数据采集系

weixin_30335353的博客 443

PAT:A1012 The Best Rank (25 分)

PAT:A1012 The Best Rank (25 分) To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus...

Ecloss 903

【SigmaStudio】自定义算法组件之源码规范(二)

工作中自定义算法组件一般是dll文件,生成dll文件需要XML文件和DLB文件,记录一下DLB文件代码的编码规范,定义SigmaStudio SHARC算法开发的编码规则,涵盖函数原型、内存管理、接口结构体等关键要求,确保算法模块与SigmaStudio环境兼容

liang_song的博客 1377

科研级YOLOv8 Neck革新:BiFPN双向特征金字塔赋能,让多尺度融合更高效的实战指南

在文件夹下新建BiFPN.py,将上述BiFPNLayer和BiFPN类的代码写入其中。这一步是为了让YOLOv8的代码架构能识别我们的自定义Neck模块。

m0_64661770的博客 153

PAT—A1012 The Best Rank (25 分)

题目地址: PAT—A1012 The Best Rank (25 分) 题意 首先输入给出 n , m 代表 n 个学生和 m 个查询,接下来的 n 行分别输入 n 个学生的学号和 C , M , E 三科成绩( A 是三科成绩四舍五入得到的平均成绩。现在要求分别按 4 个分数(C , M , E , A)对 n 个学生进行排名(分数一样的具有相同的名次),这样对每个学生来说都有四个名次(每个...

weixin_43870123的博客 267

4.6 知识库使用指南:如何让AI Agent拥有专业知识

本文介绍了如何为AI Agent构建和使用知识库。知识库的作用是为Agent提供专业知识,包含文档、数据和规则,可用于专业问答和知识检索。使用方法包括创建知识库(上传文档)、向量化处理、知识检索以及在Agent中的应用。核心要点是理解知识库的价值和使用流程。文章还提出了构建方法、检索优化和应用实践等思考题,建议准备高质量数据、优化检索效果并持续更新知识库。下节将介绍用LangGraph构建复杂AI应用。

yonggeit的博客 3013

PAT A1012. The Best Rank (25)

原文链接: PAT A1012. The Best Rank (25) ...

阿豪 89

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

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

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

[PAT-Advanced] A1012 The Best Rank (25)

文章目录A1012 The Best Rank (25point(s))Input Specification:Output Specification:Sample Input:Sample Output:CodeAnalysis、 A1012 The Best Rank (25point(s)) To evaluate the performance of our first year CS ...

Duke 274

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

A1012 The Best Rank (25分)【C语言】

A1012 The Best Rank (25分)【C语言】 原题链接 晴神… 题目描述: To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - English. At t

SASAKI_130的博客 319

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...

A1012 The Best Rank (25 分)

To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - Eng...

哈士奇想咬你的博客 323

A1012 The Best Rank (25分)

A1012 The Best Rank (25分) 一、题目描述 To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), and E - English. At the mean time,

qq_45735298的博客 202

PAT A1012 Best Rank(25)

题目描述 To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algrbra), a...

105

PAT A1012 The Best Rank (25分)

题意:给三个分数CME,加上算出来的平均分(要四舍五入,测试了才发现的),4个分数对应有4个排名,给出他们的最好排名(聊以自慰嘛→_→),最后根据给出的查询编号,查询出他们的最好排名和对应学科,或者查无此人。 AC代码: //1012 The Best Rank (25分) https://pintia.cn/problem-sets/994805342720868352/problem...

tangobravo的博客 354

A1012 The Best Rank (25)

方法一: 本题本人采取的思路是利用堆排序和dp来确定任何一个分数的名次。结构体数组的规模是1000000,存储任何一个学号对应的成绩。结构体数组不排序,用下标作为id。名次的获得采用桶排序O(n) 方法二: 首先需要用结构体变量存储学生信息,然后计算每个学生各个科目的成绩排名,然后通过id查询最大的排名。 结构体应存储学生的id、四个科目的成绩,然后用sort排序,分别用不同的科目成绩...

程序人生 292

A1012 The Best Rank (25 分)

#include&amp;lt;iostream&amp;gt; #include&amp;lt;cstdio&amp;gt; #include&amp;lt;cstring&amp;gt; #include&amp;lt;algorithm&amp;gt; using namespace std; struct student { int grade[4];//0-average 1-c 2-m 3-e int id; }stu[2010

A_Aria的博客 119

PAT-A 1012 The Best Rank (25 分)

每个学生有C语言、数学、英语、三门成绩的平均成绩,共4个成绩。 分别按照每一门成绩对学生进行排名,每个学生将有4个排名,取最好的那个排名为最终排名。如果一个学生有两个科目的排名都是最好的排名,那么按照平均成绩>C语言>数学>英语的优先级来确定取得最好排名的科目。比如,一个学生4个成绩排名都是第1,那么认为该学生取得最好排名的是平均成绩,输出时将输出“1 A”。 在对某一门成绩进行排序时,如果有两个学生的成绩相同,那么这两个同学在该门成绩中的排名相同。 比如C语言的成绩从高到低为100

qq_38127801的博客 365
上一篇: A1062(25)
下一篇: A1016(25)
coder_Kim
博客等级 码龄8年 2粉丝 160原创
评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值