1012 The Best Rank

1. 注意点

  1. 一名同学同样排名下的科目优先级问题
  2. 不同同学分数相同时排名相同,注意 排名不是 1 1 2 3 4 这种, 而是 1 1 3 4 5
  3. 注意到有些同学写这个题目的时候id直接用整数来表示,感觉不是很好,比如00123、0123、123的值都是一样的(不过在这个题目中没有影响)

2. python3代码

  1. data_num, output_num = map(int, input().split(" "))
  2. data_list = []
  3. for i in range(data_num):
  4. input_line = input().split(" ")
  5. line_data = [input_line[0]]
  6. line_data.extend(list(map(int, input_line[1:])))
  7. line_data.append((round(sum(line_data[1:])/3)))
  8. data_list.append(line_data)
  9. def courseSort(data_list, line_id):
  10. data_list.sort(key=lambda i:i[line_id], reverse=True)
  11. sort_dict = {}
  12. rank = 1
  13. score = -1
  14. for index, item in enumerate(data_list):
  15. if item[line_id] != score:
  16. score = item[line_id]
  17. rank = index+1
  18. sort_dict[item[0]] = rank
  19. return sort_dict
  20. c_sort = courseSort(data_list, 1)
  21. m_sort = courseSort(data_list, 2)
  22. e_sort = courseSort(data_list, 3)
  23. a_sort = courseSort(data_list, 4)
  24. output = ''
  25. for i in range(output_num):
  26. sno = input()
  27. if sno not in a_sort:
  28. output += "N/A\n"
  29. else:
  30. max_rank = min([a_sort[sno], c_sort[sno], m_sort[sno], e_sort[sno]])
  31. if a_sort[sno] == max_rank:
  32. output += str(max_rank) + " A\n"
  33. elif c_sort[sno] == max_rank:
  34. output += str(max_rank) + " C\n"
  35. elif m_sort[sno] == max_rank:
  36. output += str(max_rank) + " M\n"
  37. else:
  38. output += str(max_rank) + " E\n"
  39. 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. 洛谷P1200 [USACO1.1]你的飞碟在这儿Your Ride Is Here

    题目描述 众所周知,在每一个彗星后都有一只UFO.这些UFO时常来收集地球上的忠诚支持者.不幸的是,他们的飞碟每次出行都只能带上一组支持者.因此,他们要用一种聪明的方案让这些小组提前知道谁会被彗星带走 ...

  2. LED Holiday Light -holiday Light Inspection Implementation Recommendations

    China LED Holiday Light Factory & Ninghai County Haohua Electronic Appliance Co., Ltd. pointed o ...

  3. K3标准产品的BOS单据发布至自定义模块

    在自定义模块 下先随便发布一张单据,然后后台更新数据表. select * from icclasstype where fname_chs like '付款申请单%'   --查询表单的ID upd ...

  4. 在myEclipse中根据图表自动生成Hibernate文件

    1.新建一个Java Project项目,在scr中创建两个包:Com.hibernate.po 和com.hibernate.dao 2. 3.点击ok 4. 5.选中MyElipse Derby, ...

  5. (转)git使用规范

    转自:http://www.ruanyifeng.com/blog/2015/08/git-use-process.html 团队开发中,遵循一个合理.清晰的Git使用流程,是非常重要的. 否则,每个 ...

  6. gulp安装报错Local version: Unknown

    解决方法 使用国内的淘宝镜像安装: cnpm install -g gulp 一开始只执行了上面命令,没执行下面,gulp -v 之后显示Local version: Unknowncnpm inst ...

  7. Test Blog

    计算机实习报告 姓名:王方正 学号:20174314 一.开发任务 题目源自<程序设计实践教程>教材22题,学生基本信息管理.描述略. 二.需求分析 1.说明自己针对这个任务将完成哪些功能 ...

  8. 【转载】17个新手常见Python运行时错误

    转自:http://www.cnblogs.com/smile-ls/archive/2013/05/20/3088393.html 当初学 Python 时,想要弄懂 Python 的错误信息的含义 ...

  9. SpringBoot学习- 10、设计用户角色权限表

    SpringBoot学习足迹 前几节已经基本了解了SpringBoot框架常用的技术,其他的消息队列,定时器等技术暂时用不到,真正项目中如果基于微信系,阿里系开发的话,还要了解平台专用的技术知识,学习 ...

  10. android 获取所有SD卡目录

    //返回sd卡路径public static List<String> getStorageDirectories(Context context) { StorageManager sm ...