1025 PAT Ranking (25 分)

kettle写doris操作 文件在目录:doris-master\extension\kettle\assemblies\plugin\target\doris-stream-loader-plugins-9.4.0.0-343.zip。官方提供了doris stream load插件,下载源码编译后放到kettle的插件目录即可使用。地址:https://github.com/apache/doris.git。注意:需要doris插件或者kettle转换生成模板的私聊博主。使用PDmaner同步业务库生成建表语句。 阅读详情

在这里插入图片描述
1025 PAT Ranking (25 分)
Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists will be merged immediately after the test. Now it is your job to write a program to correctly merge all the ranklists and generate the final rank.

Input Specification:
Each input file contains one test case. For each case, the first line contains a positive number N (≤100), the number of test locations. Then N ranklists follow, each starts with a line containing a positive integer K (≤300), the number of testees, and then K lines containing the registration number (a 13-digit number) and the total score of each testee. All the numbers in a line are separated by a space.

Output Specification:
For each test case, first print in one line the total number of testees. Then print the final ranklist in the following format:

registration_number final_rank location_number local_rank
The locations are numbered from 1 to N. The output must be sorted in nondecreasing order of the final ranks. The testees with the same score must have the same rank, and the output must be sorted in nondecreasing order of their registration numbers.

Sample Input:
2
5
1234567890001 95
1234567890005 100
1234567890003 95
1234567890002 77
1234567890004 85
4
1234567890013 65
1234567890011 25
1234567890014 100
1234567890012 85
Sample Output:
9
1234567890005 1 1 1
1234567890014 1 2 1
1234567890001 3 1 2
1234567890003 3 1 2
1234567890004 5 1 4
1234567890012 5 2 2
1234567890002 7 1 5
1234567890013 8 2 3
1234567890011 9 2 4

#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
struct student{
	char registration_number[15];
	int score;
	int final_rank;
	int location_number;
	int local_rank;
}Student[30005];
bool cmp(student a,student b){
	if (a.score != b.score) return a.score > b.score;
	else return strcmp(a.registration_number, b.registration_number) < 0;
}
int main() {
	int N,K;
	int count = 0;
	cin >> N;
	for (int i = 1; i <= N; i++) {
		cin >> K;
		for (int j = count; j < count + K; j++) {
			cin >> Student[j].registration_number >> Student[j].score;
			Student[j].location_number = i;
		}
		sort(Student + count, Student + count + K, cmp);
		Student[count].local_rank = 1;
		for (int k = count; k < count + K; k++) {
			if (Student[k].score == Student[k - 1].score) {
				Student[k].local_rank = Student[k - 1].local_rank;
			}
			else {
				Student[k].local_rank = k-count+1;
			}
		}
		count = count + K;
	}
	cout << count << endl;
	sort(Student, Student + count, cmp);
	Student[0].final_rank = 1;
	for (int q = 1; q < count; q++) {
		if (Student[q].score == Student[q - 1].score) {
			Student[q].final_rank = Student[q - 1].final_rank;
		}
		else
		{
			Student[q].final_rank = q+1;
		}
	}
	for (int p = 0; p < count; p++) cout << Student[p].registration_number << " " << Student[p].final_rank << " " << Student[p].location_number << " " << Student[p].local_rank << endl;
}
Habitat安装全网最详细教程,手把手带你跑通example.py(全网唯一) 全网最详细具身智能仿真平台habitat的安装教程 阅读详情

相关推荐

手把手教你用STM32实现SPWM逆变器控制(附完整代码)

本文提供了一份基于STM32实现SPWM逆变器控制的完整实战指南。文章从硬件选型(如STM32F103C8T6、IR2104驱动器)入手,详细解析了利用定时器TIM1生成SPWM波形的核心原理与代码实现,并涵盖了驱动电路、全桥功率电路及LC滤波器的设计要点与调试技巧,旨在帮助读者从零构建一个可靠的单相全桥逆变器系统。

weixin_29208327的博客 590

PAT Ranking

PAT Ranking Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists will be merged immediately after the test. No

weixin_44876084的博客 249

Android应用加固脱壳实战:从爱加密原理到Frida内存Dump与修复

在移动应用安全领域,代码加固与动态加载是保护核心逻辑的关键技术。其原理在于通过修改应用启动流程,将原始DEX加密隐藏,并注入包含解密逻辑的壳DEX,实现运行时动态加载。这项技术的核心价值在于防止应用被逆向分析、二次打包或恶意篡改,广泛应用于金融、游戏等高安全要求场景。对于安全研究、漏洞挖掘或历史版本审计,掌握脱壳技能至关重要。本文聚焦于**爱加密**等主流加固方案,深入探讨如何利用**Frida**框架在内存中精准捕获解密后的DEX数据,并解决脱壳后常见的签名校验等运行问题,提供一套从原理到实践的完整攻防思

weixin_28716443的博客 490

【点3WA】PAT 甲级 1104 PAT Ranking 个人错误总结

这题的点让人头大,记着long double。 %Lf PS:晴神柳神的代码都是double的,貌似是新改的测试点。 另外算乘法的时候,要把那个double型的乘在前面,否则会错误,因为没有类型转换,int可能溢出。 #include<stdio.h> #include<iostream> #include<algorithm> using namespace std; double a[100000]; int main(){ int n; double sum=

☁的博客 164

HDMI端口辐射(EMI)超标解决方案

HDMI端口辐射(EMI)超标解决方案 一、HDMI EMC设计要求: 1、HDMI EMC设计原理图 ( 图 一 ) 2、HDMI元件选型及参数说明:(图一所示) a.L510、L511、L512、L513使用专业EMI共模滤波器(普通共模电感寄生电容太大,会导致TMDS差分阻抗匹配测试失败),阻抗值为90Ω~100Ω(两路共模滤波器型号:CMF1210DH900MFR;四路共模滤波器型号:CMF2010DH101MFR), b.U1、U2为排式ESD(ESD排型号:ESD0524PA),越低的结电容

ltqdxl的博客 1万+

uni-app - 将 base64 图片编码转为 Blob 本地文件路径(把base64类型的图片,转换成blob二进制文件流)适用于 uni-app / vue.js / JavaScript

uni-app/vue.js/JavaScript将base64转Blob,uniappapp端如何将图片的base64编码转换成File对象或Blob,uni-app/vue.js/JavaScript中拿到base64转blob对象,uniapp图片base64格式转blob格式方法,uniapp上传图片压缩转base64码与base64转图片路径,Base64/Blob/File图片文件转换,url、base64、blob相互转换方法,读取本地文件为Base64并转成B

🏆 前端领域优质创作者 1万+

1025 PAT Ranking 卡在测试点3

1025 PAT Ranking (25分) 还有一个是第3个测试点,注册号也就是id,需要声明为char[]或string类型,而不能设置为long long类型;这样就避免了当 ID是 000000000003 输入时,输出id的错误产生。 ...

weixin_41809001的博客 766

华为OD机试 - 计算误码率(Python/JS/C/C++ 双机位C卷 100分)

移动通信 网络中的误码率主要是指比特误码率,其计算公式如下:比特误码率 = 错误比特数 / 传输总比特数,为了简单,我们引入字符串来表示误码通信的信息,一个字符错误了,就认为出现了一个误码。我们需要将这两个压缩字符串解压成实际的字符序列,然后逐位比较它们,统计误码(不同字符)的数量。题目给出两个经过压缩编码的字符串,通过解压缩后需要判断两个字符串在解压后的误码率,即对应位置不同的字符数量占总字符数量的比例。输入一个标准的字符串,和一个传输前的字符串,计算误码率。两个解压后的字符串完全相同,没有错误字符。

学Java,找哪吒 2193

PAT 甲级 1013 PAT Ranking 个人错误总结

惊了超时,竟然是cin的问题。。 scanf没事了。 dfs,每次判断这次是不是改了flag,可以找到各个极大子连通图个数。减1即可。 #include<bits/stdc++.h> using namespace std; bool road[1000][1000]; bool flag[1000]; int n; bool flag1; void dfs(int root,int temp){ if(root==temp)return; if(root<=n&&fl

☁的博客 143

【Python深度学习】做深度学习训练时,如果数据集太大,无法一次性加载进GPU,应该如何做?

方法核心思想优点缺点适用场景实现复杂度小批量训练(Mini-Batch Training)与数据加载器(DataLoader)将数据集划分为小批量,每次只加载一个小批量到GPU中进行训练。- 易于实现- 是深度学习的标准做法- 支持多进程加载- 内存可能成为瓶颈- 需要调整批量大小避免内存不足适用于大部分场景低数据分片与分布式训练(Data Sharding & Distributed Training)将数据集分片,每个GPU或节点处理其中一部分数据,分布式训练。

若北辰 1143

知识图谱大模型系列之 12 LLM 知识图谱构建器:从零到 GraphRAG 使用 LLM 知识图谱生成器在 GenAI 应用中提取和使用知识图谱(教程含源码)

为了更深入地了解 LLM 知识图谱构建器,GitHub 存储库提供了大量信息,包括源代码和文档。此外,我们的文档提供了详细的入门指南,而GenAI 生态系统则提供了有关可用更广泛工具和应用程序的进一步见解。

iCloudEnd的博客 2037

1025 PAT Ranking (25 分)

Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklist...

韩江雪de 小屋 614

AI编程工具深度对比:Cursor、Copilot、Trae与Claude Code,2025年开发者该如何选择?

2025年AI编程工具市场已形成四大主力阵营:Cursor(AI原生IDE)、GitHub Copilot(行业标准)、Trae(中国免费方案)和Claude Code(终端交互)。核心差异体现在技术能力(代码生成准确率85%-95%)、智能体协作程度和上下文处理能力(8K-200K tokens)。用户体验方面,Trae对中文支持最佳且免费,Copilot企业集成强,Cursor平衡易用与功能,Claude Code适合高阶开发者。实际测试显示,不同工具在原型开发、算法实现等场景各有优势

fudaihb的博客 6496

PAT——1025 PAT Ranking (25 分)

1025PAT Ranking(25分) Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several pl...

Yanir的博客 178

efm32 入门.pdf

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

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

(PAT甲级)1025 PAT Ranking (25分)

(PAT甲级)1025 PAT Ranking (25分) Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in sever...

weixin_45783166的博客 321

深度学习工具包 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")

1025 PAT Ranking (25 分)

1025 PAT Ranking (25 分) Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several pla...

qq_39339575的博客 163

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

1025 PAT Ranking (25 分)

1025PAT Ranking(25分) Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several pl...

树叶子的博客 1089

1025 PAT Ranking (25分)

题目 Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklist...

小白的博客 223

1025 PAT Ranking (25 分) 题解

1025 PAT Ranking (25 分) Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several pl...

lzy我就来随便逛逛的博客 344

PAT A1025 PAT Ranking (25 分)

题目:1025PAT Ranking(25分) Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several...

菜鸟的博客 430
上一篇: 1082 Read Number in Chinese (25 分)
下一篇: 1020 月饼 (25 分)
好想当依蕾娜小姐的狗
博客等级 码龄7年 0粉丝 62原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值