HDOJ1084 What Is Your Grade?
What Is Your Grade?
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!
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.
4
5 06:30:17
4 07:31:27
4 08:12:12
4 05:23:13
1
5 06:30:17
-1
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?的更多相关文章
- 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 ...
- POJ 3666 Making the Grade
Description A straight dirt road connects two fields on FJ's farm, but it changes elevation more tha ...
- 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 ...
- POJ3666Making the Grade[DP 离散化 LIS相关]
Making the Grade Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6445 Accepted: 2994 ...
- [CareerCup] 15.7 Student Grade 学生成绩
15.7 Imagine a simple database storing information for students' grades. Design what this database m ...
- 英语语法 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 ...
- FPGA speed grade
Altera的-6.-7.-8速度等级逆向排序,Xilinx速度等级正向排序. 不很严密地说,“序号越低,速度等级越高”这是Altera FPGA的排序方法, “序号越高,速度等级也越高”这是Xili ...
- HDU 5038 Grade(分级)
Description 题目描述 Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of ...
- hdu---(5038)Grade(胡搞)
Grade Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Sub ...
随机推荐
- poj 2663 Tri Tiling (状压dp+多米诺骨牌问题+滚动数组反思)
本来直接一波状压dpAC的 #include<cstdio> #include<cstring> #include<algorithm> #define REP(i ...
- oracle 控制语句
PL输出语句 set serverout on; -- 开启PL的输出语句功能declare n number:=1; -- 声明一个number型的变量n,并赋值为1 v varchar2(20): ...
- Mysql学习总结(33)——阿里云centos配置MySQL主从复制
1.安装jdk1.8 首先确定没有安装过jdk 2.yum –y list java*查询系统自带的jdk安装包情况. 3.安装jdk1.8 4. 验证安装结果. 安装mysql 1. rpm -Uv ...
- CC2540/CC2541 : Set the Peripheral Being Advertising while It is Being Connected
There is possible to set your CC254X be scanable when it is in connection. But, based on my test,the ...
- cximage功能简介
CxImage是一个可以用于MFC 的C++图像处理类库类,它可以打开,保存,显示,转换各种常见格式的图像文件,比如BMP, JPEG, GIF, PNG, TIFF, MNG, ICO, PCX, ...
- 简单的floyd——初学
前言: (摘自https://www.cnblogs.com/aininot260/p/9388103.html): 在最短路问题中,如果我们面对的是稠密图(十分稠密的那种,比如说全连接图),计算多 ...
- http协议无状态中的 "状态" 到底指的是什么?!(转载)
转载自:https://www.cnblogs.com/bellkosmos/p/5237146.html 引子: 最近在好好了解http,发现对介绍http的第一句话[http协议是无状态的,无 ...
- 解决JavaScript浮点数(小数) 运算出现Bug的方法
解决JS浮点数(小数) 运算出现Bug的方法例如37.2 * 5.5 = 206.08 就直接用JS算了一个结果为: 204.60000000000002 怎么会这样, 两个只有一位小数的数字相乘, ...
- 访问Storm ui界面,出现org.apache.storm.utils.NimbusLeaderNotFoundException: Could not find leader nimbus from seed hosts ["master" "slave1"]. Did you specify a valid list of nimbus hosts for confi的问题解决(图文详解)
不多说,直接上干货! 前期博客 apache-storm-1.0.2.tar.gz的集群搭建(3节点)(图文详解)(非HA和HA) 问题详情 org.apache.storm.utils.Nimbu ...
- split(":")[0].substring(1)
java中拆分字符中的split(":")[0].substring(1)是什么意思啊,尤其[0] 可以解释一下吗?:比如你有一个字符串 "111:222:333&quo ...