1012 The Best Rank

1. 注意点

  1. 一名同学同样排名下的科目优先级问题
  2. 不同同学分数相同时排名相同,注意 排名不是 1 1 2 3 4 这种, 而是 1 1 3 4 5
  3. 注意到有些同学写这个题目的时候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的更多相关文章

  1. 1012 The Best Rank (25 分)

    1012 The Best Rank (25 分) To evaluate the performance of our first year CS majored students, we cons ...

  2. 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 ...

  3. PAT甲级1012. The Best Rank

    PAT甲级1012. The Best Rank 题意: 为了评估我们第一年的CS专业学生的表现,我们只考虑他们的三个课程的成绩:C - C编程语言,M - 数学(微积分或线性代数)和E - 英语.同 ...

  4. 1012 The Best Rank (25分) vector与结构体排序

    1012 The Best Rank (25分)   To evaluate the performance of our first year CS majored students, we con ...

  5. 【PAT】1012. The Best Rank (25)

    题目链接: http://pat.zju.edu.cn/contests/pat-a-practise/1012 题目描述: To evaluate the performance of our fi ...

  6. 1012. The Best Rank (25)

    To evaluate the performance of our first year CS majored students, we consider their grades of three ...

  7. PAT 1012. The Best Rank

    To evaluate the performance of our first year CS majored students, we consider their grades of three ...

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

    problem To evaluate the performance of our first year CS majored students, we consider their grades ...

  9. 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 ...

随机推荐

  1. Invalid Native Object

    发现是因为没有addChild到父节点上引起的

  2. Qtree3 - 树链剖分

    打完以后才发现写复杂了……算了懒得改了 #include <bits/stdc++.h> using namespace std; ],fa[][],size[],wson[],vis[] ...

  3. MyEclipse-2017破解过程

    下载 myeclipse2017百度云下载路径: 链接:https://pan.baidu.com/s/1wQYwO2zrUvbbUcjCB5B8IQ 密码:6igu myeclipse2017破解文 ...

  4. PHP实现导出Excel文件

    实现代码: private function exportExcel($params) { $arr = $this->getExportData($params); // 获取需要导出的信息( ...

  5. 在npm上如何发布自己的包

    环境需要:node和npm 然后在本地建一个文件夹作为你要发布的模块 然后在这个文件夹下打开cmd 执行:npm init 按照提示写对应的,或者先不写也可以,最后y 这时候在mcrm这个文件夹下就出 ...

  6. 题解 AT859 【元素の系統名】

    题目传送门. 介绍一种使用string字符串的方法. \(string\)是\(C++\).\(java\).\(VB\)等编程语言中的字符串,字符串是一个特殊的对象,属于引用类型. \(C++\)标 ...

  7. tensorflow-gpu安装

    添加清华源(输入清华仓库镜像),可以提高下载速度: conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/ ...

  8. 10.3lambda表达式笔记

    与参数不同被捕获的变量的值是在lambda创建时拷贝,而不是调用时拷贝 void fcn() { int v1 = 42; //局部变量 auto f = [v1] { return v1; }; a ...

  9. OpenShift 4.3环境中创建基于Go的Operator

    详细步骤可以参考官方文档 https://docs.openshift.com/container-platform/4.3/operators/operator_sdk/osdk-getting-s ...

  10. conn (php)

    <?php$host="localhost";$db_user="root"; //数据库用户$db_pass=""; //数据库密码 ...