1025 PAT Ranking (25分) 【成绩排名】

TCN实战:用Python手把手搭建时序预测模型(附完整代码) 本文详细介绍了如何使用Python搭建TCN(Temporal Convolutional Network)时序预测模型,包括数据预处理、模型架构实现、训练调优及预测评估。通过完整的代码示例和实用技巧,帮助开发者快速掌握TCN在时间序列预测中的应用,特别适合处理长期依赖问题。 阅读详情

题目:https://pintia.cn/problem-sets/994805342720868352/problems/994805474338127872

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 id[15]; //准考证号
	int score; //分数
	int local_number; //考场号
	int local_rank; //考场内的排名	
}stu[30010];

bool cmp(student a,student b)
{
	if(a.score!=b.score) return a.score>b.score;
	else return strcmp(a.id,b.id)<0;
} 

int main()
{
	int n; //考场数 
	int k;
	int num=0; //总人数 
	cin>>n;
	
	//按考场数遍历 
	for(int i=1;i<=n;i++)
	{
		cin>>k; //考场内人数
		
		//先输入考场内人员的信息 
		for(int j=0;j<k;j++)
		{
			cin>>stu[num].id>>stu[num].score;
			stu[num].local_number=i;
			num++;
		} 
		
		//然后排序 
		sort(stu+num-k,stu+num,cmp);
		
		//然后定排名 
		stu[num-k].local_rank=1;
		for(int j=num-k+1;j<num;j++)
		{
			if(stu[j].score==stu[j-1].score)
			{
				stu[j].local_rank=stu[j-1].local_rank;
			}
			else
			{
				stu[j].local_rank=j-(num-k)+1;
			}
		}
		
	} 

	cout<<num<<endl;
	
	//整个所有数据排序 
	sort(stu,stu+num,cmp);
	int r=1;
	cout<<stu[0].id<<' '<<r<<' '<<stu[0].local_number<<' '<<stu[0].local_rank<<endl;
	
	for(int i=1;i<num;i++)
	{
		if(stu[i].score!=stu[i-1].score)
		{
			r=i+1; 
		}
		cout<<stu[i].id<<' '<<r<<' '<<stu[i].local_number<<' '<<stu[i].local_rank<<endl;
	}
	return 0;
}

 

嵌入式开发环境Vscode开发STM32单片机程序 STM32单片机非常强大,大多数教程都是使用 keil 编译器,keil 是收费的而 gcc 是开源免费的。这里介绍一些使用 gcc +开发单片机程序的经验。(这里不解释 gcc 是什么)。 阅读详情

相关推荐

【技术解析】AlexNet——从ReLU到Dropout的深度学习关键突破

本文深入解析AlexNet在深度学习领域的关键突破,重点探讨了ReLU激活函数和Dropout技术的革命性应用。作为卷积神经网络的里程碑,AlexNet通过ReLU解决梯度消失问题,利用Dropout有效防止过拟合,为现代深度学习模型奠定了重要基础。这些创新技术至今仍在计算机视觉和自然语言处理等领域发挥重要作用。

weixin_33719619的博客 273

【leetcode】1030 距离顺序排列矩阵单元格 Matrix Cells in Distance

【LeetCode】1030 距离顺序排列矩阵单元格 Matrix Cells in Distance

pyy_lucy的博客 214

51单片机也能玩转信号发生器?手把手教你用DAC0832和LM358输出四种标准波形

本文详细介绍了如何使用51单片机和DAC0832芯片搭配LM358运放,自制低成本信号发生器,实现正弦波、矩形波、三角波和锯齿波四种标准波形的输出。从硬件选型、电路设计到编程实现,手把手教你完成这一实用电子项目,总成本不到50元,适合电子爱好者和学生实践。

weixin_30530939的博客 553

1025 PAT Ranking(排序)

1025 PAT Ranking

老顽固也可爱 277

Python爬虫实战:如何高效抓取拼多多商品信息、销量与价格数据,破解反爬虫挑战

**摘要:**本文介绍利用Python爬虫技术抓取拼多多商品数据(价格、销量等)的方法与应用价值。通过分析拼多多商品页面的HTML结构,使用Requests和Selenium获取数据,并应对反爬虫机制(IP代理、请求头伪装等)。数据可存储于MongoDB或CSV用于市场监控、竞品分析等场景。文章涵盖技术选型、实战代码示例及反爬策略,为电商数据分析提供实用指导。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 1673

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 several pla

柳婼 の blog 2421

日常工作记录---在虚拟机中进行slam建图

   今天是10月24号,首先祝各位程序员们节日快乐!!!    最近一周由于实习的原因,对ROS的探索学习,停滞了一段时间,所以今天也就没什么大的进展,本篇文章仅仅记录一下,我在虚拟机中进行slam建图可行性验证的过程,本篇文章同样使用古月学院《如何在Gazebo中实现阿克曼转向车的仿真》的课程资料来进行验证    下面各条之间并没有严格的顺序关系,每一条都是独立的,都是我在验证过程中的经验或者记录:    1、在运行roslaunch bringup racecar_gazebo_rviz.lau

慕羽★的博客 4829

[PAT甲级]1025 PAT Ranking 详细题解+AC代码

以下所述均为个人理解,如有错误,还望指正。

zzylalalala的博客 1161

微信小程序 - 解决支付报错 requestPayment:fail access denied (微信支付提示错误requestPayment:拒绝访问失败,真机运行测试或打包编译上线后报错问题)

微信小程序,微信支付,wx.requestPayment,微信小程序支付报错requestPayment:fail access denied,调不起微信,无法唤起支付弹窗,支付失败,支付权限没问题,小程序上线后支付报错,小程序真机测试支付报错,微信小程序苹果ios系统手机无法支付,小程序发布上线后支付报错,本地测试没问题,拒绝访问失败,小程序调起支付API requestPayment:fail:access denied微信开发者工具正常支付,权限没问题,微信公众平台,依旧报错怎么办,检查了appid都

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

华为OD机试2025C卷 - 精准核酸检测 (C++ & Python & JAVA & JS & GO)

华为OD机试2025C卷 精准核酸检测,提供Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解

qq_45776114的博客 1710

PAT甲级1025(PAT 排名)

1025 PAT Ranking (25 point(s))   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 se...

云胡的博客 494

Trae中配置和使用MCP 服务保姆级教程

您好,我是程序员夏叶,深度AI编程使用者,专注于分享AI编程方面的使用技巧和经验,有兴趣的可以关注我的公众号,一起学习,共同进步。从21号开始,Trae开始陆陆续续的灰度推送了一次新版本,有的用户是21号收到的更新,有的用户是22号收到的更新,本次更新我愿称之为王炸级更新,具体更新内容可以去看我的上一篇文章。本次更新其中的一个内容就是支持了MCP 服务,那么什么是MCP呢,它的全称是。

cpp加油站的专栏 8209

PAT 甲级 1025 1025 PAT Ranking (25 分) STL +sort 卡在最后一个测试点

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

小渣渣的博客 1686

数学建模模型总结

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

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

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

PAT 1025 PAT Ranking (25 分)

原题链接:1025 PAT Ranking (25 分) 关键词:排序 题目大意:pat考试的时候,每个人都有一个考场并有自己的成绩,现在要根据所有人的成绩,输出每个人在考场内的排名以及总排名。

cwtnice的博客 481

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

PAT A1025 PAT Ranking (25 分) 排序

题目大意:给出N个考场的所有考生的信息,要求按照成绩排名,输出每个考生的 总排名、考场排名、和所在考场。 排序题,输入完每个考场的考生信息时,可以一次排序得到该考生的考场排名,输入完全部考场信息后再来一次排序,可以得到所有考生的总排名。 AC代码: #include <iostream> #include <vector> #include <...

HackingGate的博客 264

1025 PAT Ranking (25 分) java 题解

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

深街酒徒的博客 420

【PAT甲级 补全前导0 vector作为函数参数】1025 PAT Ranking (25 分) Java、C++

如何补全前导0 Java String idStr = String.format("%013d", out.id); //用0补全13位 System.out.println(idStr); C++ printf("%013lld", out.id); //用0补全13位 容器vector在函数中的参数传递 (1)值传递: 形参改变不影响实参 void fun(vector<...

寒泉 2万+

【1025】PAT Ranking (25 分)

#include<iostream> #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<algorithm> #include<map> #include<vector> #inclu...

发现问题,并解决问题,批判性思维 467

PAT A 1025 PAT Ranking 题目 答案

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_30633489的博客 247

1025 PAT Ranking (25 分)

ranllist[i]可以通过复用一个vector代替;或者输入直接写入totallist(final list),用一个数标记位置,以便得到本场次的起始位置。 #include <iostream> using namespace std; #include <algorithm> #include <vector> struct testee{ st...

自己人的博客 184

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

胡小涛的博客 193

1025. PAT Ranking (25)

PAT 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 rankli

xiaobai12123的博客 315

PAT-1025 PAT Ranking (25)

题目大意:给出 n 个PAT考点,在每个考点有相应数量的学生,输入学生考号和成绩。要求输出总榜,规则为:总榜成绩排名非递减,相同成绩报名递增输出;输出格式为:考生报名号 总榜排名  所在组别 所在组别排名。解题思路:先计算考生在对应组别中的排名,然后归入总榜计算总排名。注意对排列的特殊要求即可。题目链接:https://www.patest.cn/contests/pat-a-practise/1...

zhoujian_1943的博客 184

1025 PAT Ranking (25分)(水题)

1025 PAT Ranking (25分) 分析 先按组排序,后所有记录排序即可 代码 #include<iostream> #include<vector> #include<algorithm> #include<string> #include<string.h> using namespace std; struct node { string id; int score, group_id, l_rank, g_rank; nod

大了七八个的博客 238

1025 PAT Ranking

/ 不同分按顺序排名。// 第一个考生排名为1。//按成绩由高到低排序。//n考场数,k每个考场考生数,num总人数。// 对当前考场进行排序。// 计算当前考场的排名。

x15943088920的博客 428

B1025 PAT Ranking(模拟)

B1025 PAT Ranking (25分) 块成绩和总成绩排名分开来处理,每个部分的排名分别都与id构成映射。 排rank时,第0项标1,从第一项开始排,i和i-1两项比较相同则排名延续,不同就是下标+1; #include <iostream> #include <algorithm> #include <cstdio> #includ...

没有期待的日子反而会顺顺利利 87
上一篇: PAT A1060 Are They Equal 【科学计数法】
下一篇: 字符串hash
Estrellas_
博客等级 码龄9年 273粉丝 233原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值