PAT甲级1141解题报告

2020年9月PAT甲级满分必备刷题技巧 这份技巧帮你一网打尽所有的要点 阅读详情

 

1141 PAT Ranking of Institutions (25 point(s))

After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist.

Input Specification:

Each input file contains one test case. For each case, the first line gives a positive integer N (≤10​5​​), which is the number of testees. Then N lines follow, each gives the information of a testee in the following format:

ID Score School

where ID is a string of 6 characters with the first one representing the test level: B stands for the basic level, Athe advanced level and T the top level; Score is an integer in [0, 100]; and School is the institution code which is a string of no more than 6 English letters (case insensitive). Note: it is guaranteed that ID is unique for each testee.

Output Specification:

For each case, first print in a line the total number of institutions. Then output the ranklist of institutions in nondecreasing order of their ranks in the following format:

Rank School TWS Ns

where Rank is the rank (start from 1) of the institution; School is the institution code (all in lower case); ; TWS is the total weighted score which is defined to be the integer part of ScoreB/1.5 + ScoreA + ScoreT*1.5, where ScoreX is the total score of the testees belong to this institution on level X; and Ns is the total number of testees who belong to this institution.

The institutions are ranked according to their TWS. If there is a tie, the institutions are supposed to have the same rank, and they shall be printed in ascending order of Ns. If there is still a tie, they shall be printed in alphabetical order of their codes.

Sample Input:

10
A57908 85 Au
B57908 54 LanX
A37487 60 au
T28374 67 CMU
T32486 24 hypu
A66734 92 cmu
B76378 71 AU
A47780 45 lanx
A72809 100 pku
A03274 45 hypu

Sample Output:

5
1 cmu 192 2
1 au 192 3
3 pku 100 1
4 hypu 81 2
4 lanx 81 2

题目大意:一如既往的排序模拟题。

解题思路:无脑开数组存map然后统计一下就好了。

代码如下:

#include<iostream>
#include<string.h>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<time.h>
#include<math.h>
#include<set>
#include<list>
#include<climits>
#include<queue>
#include<cstring>
#include<map>
#include<stack>
#include<string>
using namespace std;
struct st {
	string id;
	int score;
	string school;
}a[100005];
struct sc {
	int rank;
	string scho;
	double tws;
	int ns=0;
};
map<string, sc> ww;
vector<sc> res;
bool cmp(sc a, sc b) {
	if (a.tws > b.tws) {
		return true;
	}
	else if (a.tws==b.tws) {
		if (a.ns < b.ns) {
			return true;
		}
		else if (a.ns == b.ns) {
			return a.scho < b.scho;
		}
		else {
			return false;
		}
	}
	else {
		return false;
	}
}
int main()
{
	int N;
	int index = 1;
	scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		cin >> a[i].id >> a[i].score >> a[i].school;
		for (int j = 0; j < a[i].school.length(); j++) {
			a[i].school[j] =tolower(a[i].school[j]);
		}
		ww[a[i].school].scho = a[i].school;
		ww[a[i].school].ns += 1;
		switch (a[i].id[0])
		{
		case 'A':ww[a[i].school].tws += a[i].score; break;
		case 'B':ww[a[i].school].tws += a[i].score/1.5; break;
		case 'T':ww[a[i].school].tws += a[i].score*1.5; break;
		default:
			break;
		}
	}
	for (auto i = ww.begin(); i != ww.end(); i++) {
		int q = i->second.tws;
		i->second.tws = q;
		res.push_back(i->second);
	}
	sort(res.begin(), res.end(), cmp);
	res[0].rank = 1;
	for (int i = 1; i < res.size(); i++) {
		if (res[i].tws < res[i-1].tws) {
			res[i].rank = i + 1;
			index = i + 1;
		}
		else {
			res[i].rank = index;
		}
	}
	printf("%d\n", res.size());
	for (int i = 0; i < res.size(); i++) {
		printf("%d ", res[i].rank);
		cout << res[i].scho << " ";
		printf("%.0lf %d\n", res[i].tws,res[i].ns);
	}
	return 0;
}

 

传感器采集信息的频率(采样频率) 较高的采集频率通常能提供更详细的信息,但也会增加数据处理和存储的负担。在某些应用中,较高的采样频率可能是必要的,而在其他情况下,则可能会选择适当的低采样频率以降低功耗和数据处理压力。传感器采集信息的频率(采样频率)是指传感器在一定时间内对输入信号进行采样的次数。对于一些需要快速检测和响应的应用,如运动传感器、声音传感器等,高采样频率是至关重要的。高采样频率通常需要更多的功耗和更大的存储容量,因为产生的数据量更大。例如,对于快速运动的对象,较低的采样频率可能无法捕捉到运动的真实轨迹。 阅读详情

相关推荐

储能变流器(Power Control System——PCS)设计原理

储能变流器(Power Control System——PCS)可控制蓄电池的充电和放电过程,进行交直流的变换,在无电网情况下可以直接为交流负荷供电。PCS 由 DC/AC 双向变流器、控制单元等构成。PCS 控制器通过通讯接收后台控制指令,根据功率指令的符号及大小控制变流器对电池进行充电或放电,实现对电网有功功率及无功功率的调节。 PCS 控制器通过 CAN 接口与 BMS 通讯,获取电池组状态信息,可实现对电池的保护性充放电,确保电池运行安全。   储能变流器(PCS)可控制蓄电池的充电和放电过程,进

Zhouengineer的博客 5万+

1141 PAT Ranking of Institutions(25分)

根据TWS(B级score/1.5,A级score*1.0,T级score*1.5,每个机构的所有考生的成绩之和,最后取整!)进行排序,TWS相同(取整后)的机构排名相同;另外,强制转化为int型的操作要放到对每个学校总得分的时候做,不能一个学生一个学生做!:要么是你没用double,要么是你排序的时候没对分数取整。若排名相同,输出顺序按照Ns(各机构参赛人数)增序输出;若Ns仍相同,输出顺序按照机构代码字母表顺序输出;

a131529的博客 523

用Proteus8.9自带STM32F401VE的Controller仿真STM32F407ZGT6,F429IGT6

@用Proteus8.9自带STM32F401VE的Controller仿真STM32F407ZGT6,F429IGT6 一, 目前得到的 Proteus8.9版本软件能够支持的Cortex-M4固件库项目,只能到达STM32F401VE (如下图1所示)。 (图1) 作为ST公司Cortex-M4更为广泛应用的F407,F429系列芯片;现在的Proteus8.9版本软件还没有固件库支持,不能...

kaillen的博客 3万+

A1141 PAT Ranking of Institutions(25分)PAT 甲级(Advanced Level) Practice(C++)满分题解【map+多条件排序】

After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist. Input Specification: Each input file contains one test case. For each case, the first line gives a

qq_47677800的博客 573

IDEA 导入 jbolt项目(实验室非公开项目)

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 文章目录准备一、准备数据库二、IDEA导入jbolt项目 准备 在实验室群文件中下载jbolt.zip和mysql.sql两个文件 将其解压到自己的目录下 一、准备数据库 打开Navicat新建一个jbolt数据库(字符集为utf8) 导入mysql.sql文件 数据库导入完毕 二、IDEA导入jbolt项目 点击打开一个项目 选择jbolt文件夹 以Maven形式打开 打开pom.xml 在里面添加jetty-server依赖

weixin_44094842的博客 973

告别手动标注!用ENVI Classic高效搞定高光谱图像语义分割标签(以农业/地物分类为例)

本文详细介绍了如何利用ENVI Classic实现高光谱图像的半自动化智能标注,特别针对农业和地物分类场景。通过光谱特征分析、智能标注技巧和MAT文件转换,显著提升标注效率和质量,助力AI模型训练。

weixin_28694169的博客 251

【PAT甲级】1141 PAT Ranking of Institutions(25 分)

题目链接 After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist. Input Specification: Each input file...

feng_zhiyu的博客 533

rk3568 rk628桥片 rgb2hdmi

RK628 是瑞芯微全新推出的视频桥接芯片,支持丰富的显示接口,支持高分辨率大屏产品转换需求。基于DRM、FB的显示框架易于使用。 输入信号支持:HDMI、RGB、BT.1120,输出信号支持 HDMI、GVI、Dual LVDS、Dual MIPI、MIPI-CSI、RGB、BT.1120,最高支持4K 60fps 输入/输出转换,并且支持输入到输出 1/4~4倍的缩放。

weixin_35723192的博客 451

PAT(甲级)1141.PAT Ranking of Institutions (25 分)

PAT 1141.PAT Ranking of Institutions (25 分) After each PAT, the PAT Center will announce the ranking of institutions based on their students’ performances. Now you are asked to generate the ranklist. ...

乐行僧的博客 524

【ArcGIS风暴】ArcGIS 10.2导入Excel数据X、Y坐标(经纬度、平面坐标),生成Shapefile点数据图层

用过CASS的人都知道,野外数字测图得到的点数据(平面坐标)可以直接导入到CASS中,进一步绘制地形图。那么,带有坐标的数据能不能在ArcGIS中实现点图层的生成呢?答案是必须的! 本文以气象台站shp数据的生成为例,详细介绍ArcGIS 10.2中导入X、Y坐标(这里指的是经度、纬度),生成Shapefile点数据的流程。 相关阅读:《全站仪、RTK测量坐标数据在CASS和ArcGIS中展点的区别和联系》 目录 1、数据准备 2、添加X、Y数据 3、属性表连接(Join) 4、导出为Sh.

智慧空间实验室 10万+

基于Simulink的电机功率因数校正仿真

PF=SP​=视在功率有功功率​=cosϕ⋅Irms​I1​​(非正弦时)位移因数(cosϕ):基波电压电流相位差畸变因数(I1​/Irms​):谐波导致电流有效值增大本文带你完成了电机系统功率因数校正的Simulink仿真,实现了:✅ 理解了低功率因数的成因与危害✅ 搭建了无PFC、无源PFC、有源PFC三种对比模型✅ 掌握了Vienna整流器建模与dq解耦控制方法✅ 实现了PF与THD的自动计算与评估✅ 验证了有源PFC在PF、THD、稳定性上的全面优势。

amy_mhd的博客 154

PAT 1141. PAT Ranking of Institutions (25) - 甲级

1141. PAT Ranking of Institutions (25)After each PAT, the PAT Center will announce the ranking of institutions based on their students’ performances. Now you are asked to generate the ranklist.Input S...

柳婼 の blog 2803

学Simulink--基于Simulink的无迹卡尔曼滤波(UKF)目标跟踪仿真建模示例

本文详细介绍了基于Simulink的无迹卡尔曼滤波(UKF)目标跟踪仿真建模方法。首先分析了UKF相比EKF在强非线性场景下的优势,包括无线性化误差、计算效率高和鲁棒性强等特点。接着阐述了UKF的核心原理,重点讲解了无迹变换(UT)的三个关键步骤:Sigma点生成、非线性传播和加权统计重构。文章还详细说明了二维机动目标的状态向量定义、非线性状态转移模型和雷达观测模型。 在Simulink实现部分,提供了完整的建模步骤和核心代码,包括目标运动模型、雷达传感器模型和UKF算法模块的实现。通过蛇形机动场景的仿真实

xiaoheshang_123的博客 89

【C++题解集合】PAT甲级真题(包含所有类型题解)

📚专栏目标:PAT甲级真题题解集合📣专栏定位:为想考甲级PAT的小伙伴整理常考算法题解,祝大家都能取得满分!🎏唠叨唠叨:在这个专栏里我将会整理 PAT 甲级的真题题解,并将他们进行分类,方便大家参考。

Newin2020的博客 7861

android 蓝牙通讯demo

android 下蓝牙通讯demo,实现了发现蓝牙,使能蓝牙,通过蓝牙发送消息。

lwip-2.0.3

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

pat甲级 1141 PAT Ranking of Institutions (25分)

文章目录1.错误代码1.1测试结果 pat甲级 1141 PAT Ranking of Institutions (25分) 1.错误代码 #include <iostream> #include <cctype> #include <unordered_map> #include <vector> #include <algorithm> using namespace std; struct node {int score,ns;}; un

qq_44992782的博客 285

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

【PAT甲级 - C++题解】1141 PAT Ranking of Institutions

📣专栏定位:为想考甲级PAT的小伙伴整理常考算法题解,祝大家都能取得满分!

Newin2020的博客 411

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

PAT甲级真题1141: PAT单位排行

PAT甲级真题1141: PAT单位排行

进一步有一步的欢喜 289

PAT【甲级】1141

题目链接:PAT【甲级】1141 题目简述:有点和1012这个题目相似,就是给定考生的id、分数、所属机构,让我们去求解一个排名表。这个排名表每项是由rank、机构名称、总分、人数构成,排序时需按照一定的优先级进行排列。 #include<bits/stdc++.h> using namespace std; struct node{ string institution; int score; int total; bool operator < (co

qq_41375322的博客 194

PAT甲级 1141

1141 PAT Ranking of Institutions (25 分) After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist. In...

YOUN尔 458

PAT甲级1141

PAT甲级1141 题目大意:给出各个考生PAT的成绩,甲级1,顶级1.5,乙级/1.5,统计每个学校总共拿了多少分以及一共有多少成员参加。先输出学校总数,然后按照总分从高到低排列,总分相同按照参赛人数从小到大排列,若参赛人数也一样则按照学校字母序排列。 map保存每个学校总分以及成员,遍历统计即可。注意这里统计分数要用double型,不然会损失精度测试点5不通过。 #include <iostream> #include <vector> #include <string&g

zerohawk的博客 188

PAT_甲级_1141 PAT Ranking of Institutions (25point(s)) (C++)【模拟/结构体排序】

目录 1,题目描述 题目大意 2,思路 数据结构 算法 3,AC代码 4,解题过程 第一搏 第二搏 1,题目描述 Sample Input: 10 A57908 85 Au B57908 54 LanX A37487 60 au T28374 67 CMU T32486 24 hypu A66734 92 cmu B76378 71 AU A47780 45 lanx...

&再见萤火虫&的博客 495

PAT 甲级 1141  PAT Ranking of Institutions

1141PAT Ranking of Institutions(25 point(s)) After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the rankli...

漫浸天空的雨色的备忘录~ 743

PAT甲级真题1141 PAT单位排行

每次 PAT 考试结束后,考试中心都会发布一个考生单位排行榜。 本题就请你实现这个功能。 输入格式 输入第一行给出一个正整数 NN,即考生人数。 随后 NN 行,每行按下列格式给出一个考生的信息: 准考证号 得分 学校 其中 准考证号 是由 66 个字符组成的字符串,其首字母表示考试的级别:B 代表乙级,A 代表甲级,T 代表顶级;得分 是 [0,100][0,100] 区间内的整数;学校是由不超过 66 个英文字母组成的单位码(大小写无关)。 注意:题目保证每个考生的准考证号是不同的。 输出格式 首先在一

qq_43738331的博客 239

17冬第二题 PAT甲级 1141 Ranking of Institutions (25分) 有点鸡贼

题目 After each PAT, the PAT Center will announce the ranking of institutions based on their students' performances. Now you are asked to generate the ranklist. Input Specification: Each input file c...

qiiingc的解题记录 794

PAT刷题记录-甲级

前言 记录PAT刷题笔记和代码。算法笔记中例题的记录已经放在《算法刷题笔记》文章中了。以下是PAT题库中算法笔记中未出现的题目,这里均为PAT甲级题目。 甲级 A1001

Maxi_0902的博客 1422

【PAT甲级A1141】 PAT Ranking of Institutions (25分)(c++)

1141 PAT Ranking of Institutions (25分) 作者:CHEN, Yue 单位:浙江大学 代码长度限制:16 KB 时间限制:400 ms 内存限制:64 MB After each PAT, the PAT Center will announce the ranking of institutions based on their students’ performances. Now you are asked to generate the ranklist. Inpu

小庄同学的博客 174
上一篇: 小程序全栈(二)一点总结
下一篇: PAT甲级1097解题报告
Tate_Brown
博客等级 码龄9年 39粉丝 107原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值