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 ...
随机推荐
- cmd 下sql语句及结果
Microsoft Windows [版本 10.0.14393](c) 2016 Microsoft Corporation.保留所有权利. C:\Users\李长青>mysql -uroot ...
- PM2的参数配置
https://github.com/jawil/blog/issues/7 配置项: name 应用进程名称:script 启动脚本路径:cwd 应用启动的路径,关于script与cwd的区别 ...
- 2018中国大学生程序设计竞赛 - 网络选拔赛---Find Integer!--hdu6441
问题传送门:https://vjudge.net/contest/320779#problem/D 介绍一个名词:奇偶数列法则 Key part: #include<iostream> # ...
- flask入门(四)
数据库 flask在数据库这一块有一个扩展应用叫做flask-sqlalchemy,去虚拟环境里pip install一下,如下 我这边用的是mysql,指定的url是这个mysql://userna ...
- Python复制指定目录的各个子目录下的同名文件到指定文件夹并重命名
Python复制指定目录的各个子目录下的同名文件到指定文件夹并重命名 #编码类型 #-*- coding: UTF-8 -*- #导入包 import os import shutil srcpath ...
- HTML span标签
span:行内标签,不会换行用于:组合文档中的行内元素.元素和文档的组合
- 前端框架-Vue 入门
一.介绍 1.Vue.js 是什么 Vue (读音 /vjuː/,类似于 view) 是一套用于构建用户界面的渐进式框架. Vue 的核心库只关注视图层,不仅易于上手,还便于与第三方库或既有项目整合. ...
- Nessus安装出现localhost:8834无法访问
1.下载Nessus https://www.tenable.com/downloads/nessus#download 2.安装方法 详细安装方法参考下文 https://www.ld80.cn/a ...
- [LOJ144] DFS 序 1 - DFS序 线段树
为熟悉机房键盘而划水 #include <bits/stdc++.h> using namespace std; #define int long long const int N = 4 ...
- DeepLearningDTU: Building a RNN step by step
exercise 5: Week 5 - Recurrent Neural Networks Building your Recurrent Neural Network - Step by Step