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 ...
随机推荐
- 洛谷P1551 亲戚 (并查集模板题)
链接 https://www.luogu.org/problemnew/show/P1551 代码 #include<bits/stdc++.h> using namespace std; ...
- prach定点化处理
- Wannafly Camp 2020 Day 6M 自闭 - 模拟
按题意模拟,又乱又烦,没什么可说的 #include <bits/stdc++.h> using namespace std; #define int long long int n,m, ...
- Docker最全教程——从理论到实战(十二)
前言 Ubuntu是一个以桌面应用为主的开源GNU/Linux操作系统,应用很广.本篇主要讲述Ubuntu下使用SSH远程登录并安装Docker,并且提供了Docker安装的两种方式,希望对大家有所帮 ...
- JUC—Callable接口
一.callable接口是什么? 面试题: 获得多线程的方法几种? 正确答案如下: 传统的 是继承thread类和实现runnable接口, java5以后又有实现 callable接口 和 java ...
- ARM(哈弗、冯氏结构、总线和IO访问、处理器状态和处理机模式)
1.哈弗结构与冯氏结构 (1)区别: 是否有独立的存储架构和信号通道. (2)举例: 8086:冯氏结构(相同的存储相同的通道) STM32F103:哈弗结构(不同的存储.通道) 8051:改进的哈弗 ...
- K8s控制器
K8s控制器 POD分类 #自主式pod:退出后,不会被创建 #控制器管理的pod:在控制器的生命周期内,始终位置pod的副本数 控制器类型 ReplicationController和Replica ...
- mysql 1130 Navicat for MySQL 连接MySQL 8.0 出现1130错误
可能是帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电脑登入MySQL后,更改"MySQL"数据库"user"表里的&q ...
- Laravel 中使用 Laravel-Excel 美化
<?php use Maatwebsite\Excel\Classes\LaravelExcelWorksheet; use Maatwebsite\Excel\Exceptions\Larav ...
- python 百万级别类实例实现节省内存
# 案例: ''' 某网络游戏中,定义了玩家类Player(id,name,status) 每当有一个玩家,就会在服务器创建一个Player实例 当在线人数过多时,将产生大量实例(百万级别),消耗内存 ...