What Is Your Grade?

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 8302    Accepted Submission(s): 2547
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

这破题WA了9次才过 ⊙﹏⊙b汗

#include <cstdio>
#include <algorithm>
using std::sort; struct Node{
int pos, num, s, val;
} stu[102];
int arr[6]; bool cmp1(Node a, Node b)
{
if(a.num == b.num) return a.s < b.s;
return a.num > b.num;
} bool cmp2(Node a, Node b)
{
return a.pos < b.pos;
} int main()
{
int n, h, m, s, num;
while(scanf("%d", &n) == 1 && n > 0){
for(int i = 1; i < 6; ++i) arr[i] = 0;
for(int i = 0; i < n; ++i){
scanf("%d %d:%d:%d", &num, &h, &m, &s);
s += m * 60 + h * 3600; stu[i].pos = i;
stu[i].num = num;
stu[i].s = s;
stu[i].val = 100 - (5 - num) * 10;
++arr[num];
} sort(stu, stu + n, cmp1); for(int i = 4, pos = 0; i; --i){
if(arr[i]){
while(stu[pos].num != i) ++pos;
if(arr[i] == 1) stu[pos++].val += 5;
for(int j = 0; j < arr[i] / 2; ++j)
stu[pos++].val += 5;
}
} sort(stu, stu + n, cmp2); for(int i = 0; i < n; ++i)
printf("%d\n", stu[i].val);
printf("\n");
}
return 0;
}

HDOJ1084 What Is Your Grade?的更多相关文章

  1. kaungbin_DP S (POJ 3666) Making the Grade

    Description A straight dirt road connects two fields on FJ's farm, but it changes elevation more tha ...

  2. POJ 3666 Making the Grade

    Description A straight dirt road connects two fields on FJ's farm, but it changes elevation more tha ...

  3. CF719C. Efim and Strange Grade[DP]

    C. Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input sta ...

  4. POJ3666Making the Grade[DP 离散化 LIS相关]

    Making the Grade Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6445   Accepted: 2994 ...

  5. [CareerCup] 15.7 Student Grade 学生成绩

    15.7 Imagine a simple database storing information for students' grades. Design what this database m ...

  6. 英语语法 It all started the summer before second grade when our moving van pulled into her neighborhood

    It all started the summer before second grade when our moving van pulled into herneighborhood It all ...

  7. FPGA speed grade

    Altera的-6.-7.-8速度等级逆向排序,Xilinx速度等级正向排序. 不很严密地说,“序号越低,速度等级越高”这是Altera FPGA的排序方法, “序号越高,速度等级也越高”这是Xili ...

  8. HDU 5038 Grade(分级)

    Description 题目描述 Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of ...

  9. hdu---(5038)Grade(胡搞)

    Grade Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Sub ...

随机推荐

  1. 2019-03-20 Python爬取需要登录的有验证码的网站

    当你向验证码发起请求的时候,就有session了,记录下这次session 因为每当你请求一次验证码 或者 请求一次登录首页,验证码都在变动 验证码的链接可能不是固定的,可能需要GET/POST请求, ...

  2. 《你又怎么了我错了行了吧》第九次团队作业:Beta冲刺与验收准备

    项目 内容 这个作业属于哪个课程 软件工程 这个作业的要求在哪里 实验十三 团队作业9 团队名称 你又怎么了我错了行了吧 作业学习目标 (1)掌握软件黑盒测试技术: (2)学会编制软件项目总结PPT. ...

  3. 小记如何有顺序的搭建一个Spring的web项目

    如何有顺序的搭建一个Spring的web项目 一.新建一个简单的maven,war工程 eclipse下如有报错,右键 Deployment 单击 Generate 生成web.xml后可解决报错 二 ...

  4. HTTP请求和响应模式(B/S)(2)

    B/S          及浏览器/客服端模式 根据发送的状态码不同,显示response的状态不同

  5. Pointcut is not well-formed: expecting 'name pattern' at character position 36

    Pointcut is not well-formed: expecting 'name pattern' at character position 36 学习了:http://blog.csdn. ...

  6. C++_关于const 的全面总结

    C++中的constkeyword的使用方法很灵活.而使用const将大大改善程序的健壮性.本人依据各方面查到的资料进行总结例如以下,期望对朋友们有所帮助. Const 是C++中经常使用的类型修饰符 ...

  7. centos6.5配置SSH免password登录

    创建新用户:useradd hadoop 设置password:passwd hadoop,输入自己想要的password就可以.之后su hadoop切换用户 改动主机名:vim /etc/sysc ...

  8. 使用XMLHttpRequest解析json

    不适用内函数或者promise的方式,可以在外部提取到json数据 <!DOCTYPE html> <html lang="en"> <head> ...

  9. 使用LSTM做电影评论负面检测——使用朴素贝叶斯才51%,但是使用LSTM可以达到99%准确度

    基本思路: 每个评论取前200个单词.然后生成词汇表,利用词汇index标注评论(对 每条评论的前200个单词编号而已),然后使用LSTM做正负评论检测. 代码解读见[[[评论]]]!embeddin ...

  10. cell的重用

    cell的重用 简单来说,就是为了节省内存,系统通过一个重用的表示进行获取重用的控件 1 定义重用的标识 NSString * reuseId = @"hero"  //这里的he ...