1012 The Best Rank (25 point(s))

从CTF到实战:Frida Hook无导出SO函数的3种特殊姿势 本文深入探讨了在移动安全逆向工程中,如何利用Frida Hook无导出SO函数的三种高级技巧:字符串引用定位法、调用栈回溯法和内存特征码扫描。针对安卓So层加固和混淆场景,文章结合CTF赛题与实战案例,详细解析了每种方法的原理、实现步骤与适用场景,为安全研究人员提供了从理论到实践的完整解决方案。 阅读详情

1012 The Best Rank (25 point(s))

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, we encourage students by emphasizing on their best ranks -- that is, among the four ranks with respect to the three courses and the average grade, we print the best rank for each student.

For example, The grades of C, M, E and A - Average of 4 students are given as the following:

StudentID  C  M  E  A
310101     98 85 88 90
310102     70 95 88 84
310103     82 87 94 88
310104     91 91 91 91

Then the best ranks for all the students are No.1 since the 1st one has done the best in C Programming Language, while the 2nd one in Mathematics, the 3rd one in English, and the last one in average.

Input Specification:

Each input file contains one test case. Each case starts with a line containing 2 numbers N and M (≤2000), which are the total number of students, and the number of students who would check their ranks, respectively. Then N lines follow, each contains a student ID which is a string of 6 digits, followed by the three integer grades (in the range of [0, 100]) of that student in the order of C, M and E. Then there are M lines, each containing a student ID.

Output Specification:

For each of the M students, print in one line the best rank for him/her, and the symbol of the corresponding rank, separated by a space.

The priorities of the ranking methods are ordered as A > C > M > E. Hence if there are two or more ways for a student to obtain the same best rank, output the one with the highest priority.

If a student is not on the grading list, simply output N/A.

Sample Input:

5 6
310101 98 85 88
310102 70 95 88
310103 82 87 94
310104 91 91 91
310105 85 90 90
310101
310102
310103
310104
310105
999999

Sample Output:

1 C
1 M
1 E
1 A
3 A
N/A

注意点:

1. 关于cmp的重载函数的使用(如设置tag可以减少代码量);

2. 注意map<string,int>mp的使用;

3. 注意本题中遇到同分情况下如何赋值相同名次。 

#include<iostream>
#include<algorithm>
#include<map>
#include<string>
using namespace std;
const int MAX = 2007;
int tag=1;
struct Stu{
	string id;
	int c,m,e,a;
	int c_r,m_r,e_r,a_r;
};
bool cmp(Stu a,Stu b){
	if(tag==1) return a.c>b.c;//1 for c;
	else if(tag==2) return a.m>b.m;//2 for m
	else if(tag==3) return a.e>b.e;//3 for e
	else return a.a>b.a;//4 for a
}
int main(void){
	int N,M;
	Stu stu[MAX];
	map<string,int>mp;
	cin>>N>>M;
	for(int i=0;i<N;i++){
		cin>>stu[i].id>>stu[i].c>>stu[i].m>>stu[i].e;
		stu[i].a = stu[i].c+stu[i].m+stu[i].e;
	}
	sort(stu,stu+N,cmp);
	for(int i=0;i<N;i++){
		if(i>0 && stu[i].c==stu[i-1].c) stu[i].c_r=stu[i-1].c_r;
		else stu[i].c_r = i+1; 
	}
	tag=2;sort(stu,stu+N,cmp);
	for(int i=0;i<N;i++){
		if(i>0 && stu[i].m==stu[i-1].m) stu[i].m_r=stu[i-1].m_r;
		else stu[i].m_r = i+1; 
	}
	tag=3;sort(stu,stu+N,cmp);
	for(int i=0;i<N;i++){
		if(i>0 && stu[i].e==stu[i-1].e) stu[i].e_r=stu[i-1].e_r;
		else stu[i].e_r = i+1; 
	}
	tag=4;sort(stu,stu+N,cmp);
	for(int i=0;i<N;i++){
		if(i>0 && stu[i].a==stu[i-1].a) stu[i].a_r=stu[i-1].a_r;
		else stu[i].a_r = i+1; 
	}
	for(int i=0;i<N;i++) mp[stu[i].id]=i+1;//将id和当前对象数组的下标映射起来
	string str;
	for(int i=0;i<M;i++){
		cin>>str;
		if(mp[str]){
			int idx = mp[str]-1;
			int bestRank = stu[idx].a_r;
			char bestSub = 'A';
			if(stu[idx].c_r<bestRank) bestRank=stu[idx].c_r,bestSub='C';
			if(stu[idx].m_r<bestRank) bestRank=stu[idx].m_r,bestSub='M';
			if(stu[idx].e_r<bestRank) bestRank=stu[idx].e_r,bestSub='E';
			cout<<bestRank<<" "<<bestSub<<endl;
		}else{
			cout<<"N/A"<<endl;
		}
	} 
	return 0;
}

 

ET2012新版免狗免安装绿色软件 ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉, 立即下载

相关推荐

B站李沐讲论文笔记AlexNet

B站李沐讲论文笔记AlexNet

夏知识不进脑子薇的博客 790

1012 The Best Rank (25point(s))

1012 The Best Rank (25point(s)) 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,

佳迪斯的博客 157

麒麟V10等保三级配置实战:从auditd规则到PAM锁定的可信基线构建

Linux安全基线是信息系统可信运行的基础能力,其核心在于身份鉴别、访问控制与安全审计三大机制的协同落地。在国产化信创环境中,麒麟V10作为深度适配飞腾/鲲鹏平台的操作系统,其等保三级合规并非简单套用CentOS加固脚本,而是需围绕内核审计(auditd)、可插拔认证模块(PAM)及国产安全增强机制(如kysec)进行精细化编排。技术价值体现在将抽象条款(如GB/T 22239-2019中6.1.2、6.3.3条)转化为可验证的命令行操作,确保登录失败可锁定、关键行为可追溯、时间偏差不致日志失效。典型应用场

weixin_29969209的博客 599

1012 The Best Rank (25 point(s))

Matter: 排名也会造成影响。期次在考场上的时候不要再去为了1,2分去浪费时间,跑出来成绩就可以了。 AC:(柳诺) #include <cstdio> #include <algorithm> using namespace std; struct node { int id, best; int score[4], rank[4]; }stu...

Bonstoppo 232

DexProtector内存态匿名段检测绕过与dex重组技术

Dex文件是Android应用的核心执行单元,其结构规范(如header_item、class_def_item、code_item)决定了运行时加载与解析的底层逻辑。DexProtector通过将dex数据拆解为多个无文件名、受保护的内存匿名段(如[anon:dp_header]、[anon:dp_code]),规避传统基于文件特征或标准加载路径的检测机制。该策略依赖Android mmap内存管理与ART虚拟机对dex结构的刚性要求,形成可被观测的布局规律。理解其内存态组织原理,结合权限/大小/命名/内

weixin_30855761的博客 692

1012 The Best Rank (25 point(s))

题解 STL简单应用。 #include&lt;iostream&gt; #include&lt;algorithm&gt; #include&lt;cstdio&gt; using namespace std; const int MAXN = 2010; const int MAXM = 1e7; const int INF = 0x3f3f3f3f; struct stu { i...

徐伯莱 260

基于ROS2 Humble和VGR数据集完整部署GADEN气体分散仿真环境及模型替换实践

文章摘要 本文详细介绍了基于ROS2 Humble和VGR数据集部署GADEN气体分散仿真环境的方法。GADEN是一款专为移动机器人嗅觉研究设计的3D仿真框架,能够精确模拟气体扩散过程并集成多种环境传感器。文章从系统配置开始,逐步指导读者完成ROS2 Humble环境的搭建、GADEN框架的编译部署,以及VGR数据集的使用。VGR数据集包含120个基于真实房屋模型的CFD仿真案例,为研究提供高度真实的测试环境。教程涵盖了常见问题的解决方案,并深入探讨了气体扩散模型参数的修改方法,为机器人嗅觉算法的开发和验证

huanghm88的专栏 277

1012 The Best Rank (25)(25 point(s))

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 Algebra), and E - Eng...

学习为主,偶尔扯淡 273

zynq的irq_f2p 如何增加或修改中断引脚个数(宽度)

ZYNQ开发过程中,如果使用PL到PS的中断,会产生一个疑问,设置界面显示可以有[91:84]、[68:61]共16个中断引脚,但是并没有设置中断口的宽度,如果使用多个中断引脚,应该怎么办?如果通过concat连接多个引脚,则自动调整为对应的引脚数。例如连接3个中断信号,则自动调整为:IRQ_F2P[2:0]

FPGA艺术家的博客 837

【C2000系列DSP的Bootloader详解】实现过程、流程图与示例代码

C2000 Bootloader 的核心逻辑可概括为 “初始化→选模式→加载程序→校验→跳转” 五步。对于小白来说,无需纠结底层寄存器配置(驱动库已封装),重点理解 “启动流程” 和 “数据传输 + 校验” 的核心思想即可。 通过本文的流程图和示例代码,相信你已经掌握了 C2000 Bootloader 的核心原理。实际开发中,可基于 TI 提供的 Bootloader 示例(C2000Ware 中自带)进行修改,快速适配自己的硬件和应用场景。

昔时扬尘处 376

1012 The Best Rank (25 point(s)) - C语言 PAT 甲级

设计思路: 1. 输入过程中,记录每门成绩 1 - 100 分对应的人数 2. 得分为 i 的排名,等于得分大于 i 的总人数加 1 3. 每一次查询对应一次计算和输出 注:本程序中未存储每个学生对应的四个排名,若对同一学生重复查询需要重复计算(数据量较少,超时的可能性很小~~)

有三只土豆 232

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

PAT(甲级)1012 The Best Rank (25point(s))

题目 题目链接 思路 题目大意:给n个学生的各科成绩,对每一科都进行排名,取排名最好的一科作为该名同学的最终排名; 最好把每名同学每科的排名用一个数组Rank[id][4]都预先记录下来,然后在根据下标去查询最好的排名,这样做时间复杂度是最低的,只有排序的nlogn; 如何把每名同学各科成绩的排名统计出来?依次以平均成绩,c, m, e作为排序标准将stu数组排序,共循环4次,然后从前往后遍历stu数组,把每名同学这科成绩对应的排名填到Rank数组的对应位置。注意,每名同学的id可以作为Rank数组的下标;

hjyp的博客 259

数学建模模型总结

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

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

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

pat 甲级 1012 The Best Rank (25 point(s))

题意:输入n个学生,m个查询,输入学生的学号,分别输入C,M,E,A是平均分(采取四舍五入制,要自己算出来),输入n个学生后,再输入m个查询,找得到就输出最好的排名,以及对应最好的学科; #include<iostream> #include<algorithm> using namespace std; struct student{ int num; int score[4]; int rank[4]; int best; }s[4000]; int xueke=0;

m0_51711089的博客 322

visio安装包

Microsoft Office Visio 是一款专业的制图软件。利用经过更新的形状、协作工具和数据链接图表,创建专业级图表以简化复杂的信息。

PAT (Advanced Level) Practice 1012 The Best Rank (25 point(s))

题目:PAT A 1012 题目大意 对于每个学生有4个成绩,分别是C,M,E,A。给出一个学号,问考生的最好的排名,排名的优先次序是A,C,M,E 解题思路 分别按照优先级进行排序。因此,需要注意输入的顺序,以及分数的优先级 设置Rank[id][j]表示编号为id的考生,j这门课的成绩 #include<bits/stdc++.h> using namespace std; const int maxn=2e3+5; int cnt=0;//用来进行编号 struct Student

helloful的博客 129

PAT(A) 1012 The Best Rank (25 point(s)) C++测试点2

注意: Case2 举例:分数:100,100,90,90,80 排名:1,1,3,3,5 对map的value排序:将map的key与value转为pair<key, value>存入vector,对vector使用sort排序. #include<cstdio> #include<vector> #include<map> #include<algorithm> using namespace std; struct node{

Anpotan的博客 230

PAT题解——1012. The Best Rank (25)

[声明]:由于本人在使用《算法笔记》的过程中有部分题解和《算法笔记》上的解法不同,特此作为记录,同时可以提供新的思路供读者参考; 题目链接:https://www.patest.cn/contests/pat-a-practise/1012 解题思路: ① 为了找到最好的排名,每个学生设置一个包含各个科目排名的数组rank[4],从而可以找到最小排名的科目;又由于最小排名相同时有科目的优先级,

nustart0720 752

PTA甲级-1012 The Best Rank (25point(s))(最好的成绩)

首先,先贴柳神的博客 https://www.liuchuo.net/ 这是地址 想要刷好PTA,强烈推荐柳神的博客,和算法笔记 文章目录题目原文Input Specification:Output Specification:Sample Input:Sample Output:题目大意:反思:总结 题目原文 To evaluate the performance of our first ye...

Huangpengyu123的博客 391

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

就当一次路过丶的沙滩 278

1012 The Best Rank

1012The 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 L...

yu121380的博客 172

1012. The Best Rank (25)

第一次提交错了几个,原来是 A > C > M > E.弄成了 A > E> M > C.;ST用来存放学生ID,各科成绩和平均分(我这里平均分就直接/4了),因为成绩这里没有小数点,所以我就开了二维数组Score[4][ ScoreNum=102],其中i=0,1,2,3对应A > C > M > E,分别先统计当前某个分数Score[i][这个分数]有多少个。 COuntScore(int(*Score)[ScoreNum], int index) 再从101到0,分别统计从Score[i][100]>

⊙-→棒棒糖ing .____` 1175

1012 The Best Rank (25)(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 Algebra), and E - Eng...

minose的博客 386
上一篇: 1011 World Cup Betting (20 point(s))
下一篇: 1013 Battle Over Cities (25 point(s))
coderwait
博客等级 码龄9年 20粉丝 210原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值