1012 The Best Rank
1012 The Best Rank

1. 注意点
- 一名同学同样排名下的科目优先级问题
- 不同同学分数相同时排名相同,注意 排名不是
1 1 2 3 4这种, 而是1 1 3 4 5- 注意到有些同学写这个题目的时候id直接用整数来表示,感觉不是很好,比如00123、0123、123的值都是一样的(不过在这个题目中没有影响)
2. python3代码
data_num, output_num = map(int, input().split(" "))
data_list = []
for i in range(data_num):
input_line = input().split(" ")
line_data = [input_line[0]]
line_data.extend(list(map(int, input_line[1:])))
line_data.append((round(sum(line_data[1:])/3)))
data_list.append(line_data)
def courseSort(data_list, line_id):
data_list.sort(key=lambda i:i[line_id], reverse=True)
sort_dict = {}
rank = 1
score = -1
for index, item in enumerate(data_list):
if item[line_id] != score:
score = item[line_id]
rank = index+1
sort_dict[item[0]] = rank
return sort_dict
c_sort = courseSort(data_list, 1)
m_sort = courseSort(data_list, 2)
e_sort = courseSort(data_list, 3)
a_sort = courseSort(data_list, 4)
output = ''
for i in range(output_num):
sno = input()
if sno not in a_sort:
output += "N/A\n"
else:
max_rank = min([a_sort[sno], c_sort[sno], m_sort[sno], e_sort[sno]])
if a_sort[sno] == max_rank:
output += str(max_rank) + " A\n"
elif c_sort[sno] == max_rank:
output += str(max_rank) + " C\n"
elif m_sort[sno] == max_rank:
output += str(max_rank) + " M\n"
else:
output += str(max_rank) + " E\n"
print(output.rstrip())
1012 The Best Rank的更多相关文章
- 1012 The Best Rank (25 分)
1012 The Best Rank (25 分) To evaluate the performance of our first year CS majored students, we cons ...
- PAT甲 1012. The Best Rank (25) 2016-09-09 23:09 28人阅读 评论(0) 收藏
1012. The Best Rank (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue To eval ...
- PAT甲级1012. The Best Rank
PAT甲级1012. The Best Rank 题意: 为了评估我们第一年的CS专业学生的表现,我们只考虑他们的三个课程的成绩:C - C编程语言,M - 数学(微积分或线性代数)和E - 英语.同 ...
- 1012 The Best Rank (25分) vector与结构体排序
1012 The Best Rank (25分) To evaluate the performance of our first year CS majored students, we con ...
- 【PAT】1012. The Best Rank (25)
题目链接: http://pat.zju.edu.cn/contests/pat-a-practise/1012 题目描述: To evaluate the performance of our fi ...
- 1012. The Best Rank (25)
To evaluate the performance of our first year CS majored students, we consider their grades of three ...
- PAT 1012. The Best Rank
To evaluate the performance of our first year CS majored students, we consider their grades of three ...
- 1012 The Best Rank (25)(25 point(s))
problem To evaluate the performance of our first year CS majored students, we consider their grades ...
- PTA (Advanced Level) 1012 The Best Rank
The Best Rank To evaluate the performance of our first year CS majored students, we consider their g ...
随机推荐
- 假期学习【三】HDFS操作及spark的安装/使用
1.安装 Hadoop 和 Spark 进入 Linux 系统,参照本教程官网“实验指南”栏目的“Hadoop 的安装和使用”,完 成 Hadoop 伪分布式模式的安装.完成 Hadoop 的安装以后 ...
- tcolorbox 宏包简明教程
嗯,我消失好几天了.那么,我都在做什么呢?没错,就是写这篇文章了.这篇文章写起来着实有些费神了.于是,如果你觉得这篇文章对你有帮助,不妨扫描文末的二维码,适量赞助一下哦~! tcolorbox 宏包是 ...
- eclipse新建web项目,并将其部署到tomcat
参考链接:https://blog.csdn.net/smilehhq/article/details/78414672
- ubantu安装apache
1.命令安装: sudo apt install apache2 2.检查是否启动了Apache服务 systemctl status apache2 3.开启.关闭和重启服务器 /etc/init. ...
- eclipse中tomcat正常启动,但浏览器访问不了tomcat首页之tomcat配置问题
症状: tomcat在eclipse里面能正常启动,而在浏览器中访问http://localhost:8080/不能访问,且报404错误.同时其他项目页面也不能访问. 关闭eclipse里面的tomc ...
- pycharm运行RF脚本时的环境搭建与配置
1.安装pycharm:2.file->setting,下载插件intellibot,重启pycharm:3.配置识别RF类型文件,filefile->editor->file ty ...
- HTML代码中<%%>、<%=%>
运行.获取后台代码或值.<%%>之间可以写服务器端代码,比如<%for(var i=0;i<10;i++){//执行循环体}%>又如<%for(var i=0;i& ...
- 动态规划 ---- 最长不下降子序列(Longest Increasing Sequence, LIS)
分析: 完整 代码: // 最长不下降子序列 #include <stdio.h> #include <algorithm> using namespace std; ; in ...
- zabbix4.2配置监控MySQL
1.在被监控主机安装好MySQL 相关步骤省略. 2.创建监控所需要的MySQL账户(MySQL服务器端) MariaDB [(none)]>grant usage on *.* to zabb ...
- 【教程】Visual Studio2019安装教程
Visual Studio正式版早就可以使用了,但是好多小伙伴还是不会用,今天小编就给大家带来了最新的安装教程和激活方法. Visual Studio 2019包含社区版(Community).专业版 ...