What Is Your Grade?

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 13212    Accepted Submission(s): 4236

Problem Description

“Point, point, life of student!”
This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used in this course.
There are 5 problems in this final exam. And I will give you 100 points if you can solve all 5 problems; of course, it is fairly difficulty for many of you. If you can solve 4 problems, you can also get a high score 95 or 90 (you can get the former(前者) only when your rank is in the first half of all students who solve 4 problems). Analogically(以此类推), you can get 85、80、75、70、65、60. But you will not pass this exam if you solve nothing problem, and I will mark your score with 50.
Note, only 1 student will get the score 95 when 3 students have solved 4 problems.
I wish you all can pass the exam! 
Come on!

Input

Input contains multiple test cases. Each test case contains an integer N (1<=N<=100, the number of students) in a line first, and then N lines follow. Each line contains P (0<=P<=5 number of problems that have been solved) and T(consumed time). You can assume that all data are different when 0<p.
A test case starting with a negative integer terminates the input and this test case should not to be processed.

Output

Output the scores of N students in N lines for each case, and there is a blank line after each case.

Sample Input

4 5 06:30:17 4 07:31:27 4 08:12:12 4 05:23:13 1 5 06:30:17 -1

Sample Output

100 90 90 95 100

问题链接:HDU1084 What Is Your Grade?

问题描述:(略)

问题分析

这个题的关键是按照做题数量和完成时间计算得分,需要排序。排序后按照题意计算即可。输出结果时,需要按照原来的输入顺序输出得分,所以事先分配ID是必要的。

程序说明:(略)

参考链接:(略)

题记:(略)

AC的C++语言程序如下:

/* HDU1084 What Is Your Grade? */#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string.h>using namespace std;const int P = 5;
int sum[P + 1], tot[P + 1];const int N = 100;
struct Node {int id;    // 原始编号int num;    // 解题数量int time;   // 使用时间int score;  // 分数
} a[N];bool cmp(Node a, Node b)
{return (a.num == b.num) ? a.time < b.time : a.num > b.num;
}bool cmp2(Node a, Node b)
{return a.id < b.id;
}int main()
{int n;while(~scanf("%d", &n) && n >= 0) {memset(sum, 0, sizeof(sum));memset(tot, 0, sizeof(tot));int h, m, s;for(int i = 0; i < n; i++) {scanf("%d %d:%d:%d", &a[i].num, &h, &m, &s);a[i].id = i;a[i].time = h * 3600 + m * 60 + s;sum[a[i].num]++;}for(int i = P - 1; i > 0; i--)tot[i] = tot[i + 1] + sum[i + 1];sort(a, a + n, cmp);for(int i = 0; i < n; i++) {a[i].score = a[i].num * 10 + 50;if(a[i].num >= 1 && a[i].num < P && (((i + 1) - tot[a[i].num]) <= sum[a[i].num] / 2))a[i].score += 5;}sort(a, a + n, cmp2);for(int i = 0; i < n; i++)printf("%d\n", a[i].score);printf("\n");}return 0;
}

HDU1084 What Is Your Grade?【排序+水题】相关推荐

  1. HDOJ 5131 Song Jiang's rank list(暴力排序水题)

    Song Jiang's rank list Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 512000/512000 K (Java ...

  2. SDNU 1093.DNA排序(水题)

    Description 逆序数可以用来是描述一个序列混乱成度的量.例如,"DAABEC"的逆序数为5,其中D大于它右边的4个数,E大于它右边的1个数,4+1=5:又例如" ...

  3. poj 2388 排序的水题

    纯纯的水题. #include <iostream> #include <fstream> #include <cstdlib>using namespace st ...

  4. zcmu-1653,1654...【水题集合】

    1653: 这样真的好么(*^*) Description 在某人参加的某一场比赛中,一共有k位选手参赛,他们的编号是1到k.主办方准备了n个气球,主办方同样把这n个气球随机的编号为1到k中的一个数( ...

  5. HDU2673-shǎ崽(水题)

    如果不能够直接秒杀的题,就不算水题.又应证了那句话,有时候,如果在水题上卡住,那么此题对于你来说,也就不算是水题了额~~ 刚睡醒,迷迷糊糊. 题目的意思很简单,求一个最大的,再求一个最小的.几乎是什么 ...

  6. 水题 ZOJ 3875 Lunch Time

    题目传送门 1 /* 2 水题:找排序找中间的价格,若有两个,选价格大的: 3 写的是有点搓:) 4 */ 5 #include <cstdio> 6 #include <iostr ...

  7. HUST - 1016 幼儿园小朋友们的难题(水题)

    幼儿园的小朋友们一直在研究一个问题-- 如何在一个长长的句子中找到最大的那个非负整数(不存在负数).你很不幸的被他们拖住了,又很不幸的被他们叫去执行这个任务,你非常得不爽! 因为你觉得这么简单的问题简 ...

  8. 【CodeForces - 1201C】Maximum Median(思维,水题)

    题干: You are given an array aa of nn integers, where nn is odd. You can make the following operation ...

  9. Codeforces数据结构(水题)小结

    最近在使用codeblock,所以就先刷一些水题上上手 使用codeblock遇到的问题 1.无法进行编译-------从setting中的编译器设置中配置编译器 2.建立cpp后无法调试------ ...

最新文章

  1. 使用websploit在局域网全自动渗透
  2. php获取屏幕的宽高,JS获取屏幕宽高
  3. Java 8 Friday:语言设计很微妙
  4. JavaWeb学习过程 之c3p0的使用
  5. rabbit mq 入门
  6. js 对象深拷贝_javascript深拷贝与浅拷贝
  7. 上班摸鱼打卡模拟器微信小程序源码
  8. win7计算机怎么录屏,win7电脑怎么录屏?这个实用工具给你答案!
  9. 佳缘男的计算机软件出差,交友我在世纪佳缘认识了一个男人,今年32岁,通信接近一个月,觉得 爱问知识人...
  10. win10操作系统上编译assimp库
  11. 20吉大计算机/软件考研经验贴!
  12. 计算机数据库三级考模拟试题,计算机三级考试《数据库技术》试题与答案
  13. 2021-2027全球与中国可待因止疼药市场现状及未来发展趋势
  14. 记录一次使用Autowired报Nullpoint空指针异常的错误
  15. python星星排列_python中怎么实现星星排列
  16. notepad++设置中文界面
  17. 计算机科学与技术与测控,测控技术与仪器.PDF
  18. 判断是否有统计意义/差异具有显著性/具有显著差异/零假设(希望证明为错误的假设)/卡方检验
  19. php百度快照劫持,最新wordpress程序被挂马,百度快照被劫持的解决方法 | linux系统运维...
  20. 图的建立(邻接矩阵)与其深度优先和广度优先遍历

热门文章

  1. GDAL库读取Envisat ASAR数据
  2. Java多线程(七)——线程中断
  3. C#通用验证类:邮箱,电话,手机,数字,英文,日期,身份证,邮编,网址,IP
  4. 解决Hadoop时no namenode to stop异常或则 是 jps中没有namenode
  5. java一览删除一条数据_可以删除单条数据,不能再返回列表页面,我使用的是Spring MVC...
  6. 转码服务器 作用,转码服务器工作原理介绍.pdf
  7. 闪烁指示灯监控方案_机房温湿度监控检测方案【斯必得智慧机房】
  8. 荆楚理工学院计算机科学专业,荆楚理工学院计算机科学与技术专业2016年在湖北理科高考录取最低分数线...
  9. lg-1 x 怎么算_四六级分数怎么算?交白卷都不会得0分|巨微英语
  10. 浅谈算法(简单算法)