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 ...
随机推荐
- 【转】C语言将字符串转换成对应的数字(十进制、十六进制)
转自:http://wawlian.iteye.com/blog/1315133 1.一个十进制数字的字符串表示转换成对应的整数.举例:将“1234”转换成整数1234 /*将字符串s转换成相应的整数 ...
- Run Nutch In Eclipse on Linux and Windows nutch version 0.9
Running Nutch in Eclipse Here are instructions for setting up a development environment for Nutch un ...
- 关于android的设备管理器-DevicePolicyManager(一)
在Andorid的设置->安全里面有个设备管理器的选项,相信大部分android用户都不太会去注意这个东西.近期在安装了一个应用之后发现这个里面的东西变了.怎么回事呢,研究研究看看.</s ...
- Socket实现一个简单的半双工通信
Socket是client进行在网络与server进行数据交互的一种基本通信方式.通信有三种通信.即单工.半双工,和全双工. 所谓单工,就是仅仅可以进行单向通信,如bb机. 而半双工就是一来一回的通信 ...
- codevs 3372 选学霸(hash+并查集+多重背包)
先通过并查集处理出来有多少种不同的集合,每一个集合有多少人.一定要不要忘记了与别的没有联系的独立点. 并查集的时候能够通过hash处理出来每一个数目同样的集合的个数. 这样以人数为权值.个数为限制进行 ...
- hdu 4628 Pieces(状态压缩+记忆化搜索)
Pieces Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total S ...
- 【HDOJ 5407】 CRB and Candies (大犇推导
pid=5407">[HDOJ 5407] CRB and Candies 赛后看这题题解仅仅有满眼的迷茫------ g(N) = LCM(C(N,0),C(N,1),...,C(N ...
- JavaScript在不同环境下的全局对象
Node.js 环境下,全局的对象是 global. 浏览器下 window === self 而不是 global,今天才发现的,我惊呆了!
- lua_pcall与lua_call之间的区别
lua_pcall与lua_call之间的区别 定义: void lua_call (lua_State *L, int nargs, int nresults); int lua_pcall (lu ...
- 肆、js的DOM模型
一.网页中的dom模型框架 1.dom中的3中节点:元素节点.文本节点.属性节点 a.元素节点:html中的各种标签就是各个元素节点,元素节点可以包含其他元素,只有html根节点例外. b.文本节点: ...