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 ...
随机推荐
- LAMP+discuz网站搭建过程
LAMP+discuz网站的搭建 一. LAMP环境搭建 0x01下载配置虚拟机 网上下载centOS7 64的镜像,然后在vmware里面配置好,我配置的是linux终端桌面,运行快,占内存小. 0 ...
- vue实现网页简单计算器实例代码
效果: 代码如下: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> < ...
- ROS2GO 与WIN10 双系统安装
关于ROS2GO的一些心得: 我是一个ROS的探索者,在接触ROS一段时间后,意外发现了一个关于ROS2GO的信息,是天之博特的微信公众号发表的.简单来说ROS2GO就是一个装了ROS的Ubuntu系 ...
- linux上部署springboot应用的脚本
#!/bin/bash #getProcessId then kill pids=$(ps -ef | grep flashsale| awk '{print $2}') for pid in $pi ...
- centos开发环境搭建
1.检查是否安装php php -v yum install php 2.安装composer curl -sS https://getcomposer.org/installer |php //下载 ...
- phpstorm汉化包
链接:https://pan.baidu.com/s/1dG7AWI87dOJJezra9veFrA 提取码:btmf 下载后放到lib目录中 即可
- Python入门4 —— 输入与输出
一:输入(Input) 1.python3中的input(输入) inp_username=input("请输入您的密码:") # "18" print(inp ...
- 错误:pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', ...
- EntityFramework之原始查询及性能优化
之前做海信项目,数据量自交大,为了提高查询效率用的 https://www.cnblogs.com/CreateMyself/p/4746258.html
- winform常用控件介绍
1.窗体 12.Label 控件 33.TextBox 控件 44.RichTextBox控件 55.NumericUpDown 控件 76.Button 控件 77.GroupBox 控件 78.R ...