hdu 1084 What Is Your Grade?
http://acm.hdu.edu.cn/showproblem.php?pid=1084
What Is Your Grade?
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 9580 Accepted Submission(s): 2940
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!
A test case starting with a negative integer terminates the input and this test case should not to be processed.
#include <stdio.h>
#include <stdlib.h>
#include <string.h> #define N 110 using namespace std; struct st
{
int id, x, h, y;
} node[N]; int cmp(const void *a, const void *b)
{
st *s1 = (st *)a, *s2 = (st *)b;
if(s1->x == s2->x)
return s1->h - s2->h;
else
return s2->x - s1->x;
} int cmp1(const void *a, const void *b)
{
return *(int *)a - *(int *)b;
} int main()
{
int i, a1, a2, a3, a4, n, h, m, s;
while(scanf("%d", &n), n != -)
{
memset(node, , sizeof(node));
a1 = a2 = a3 = a4 = ;
for(i = ; i < n ; i++)
{
scanf("%d", &node[i].x);
scanf("%d:%d:%d", &h, &m, &s);
node[i].h = h * + m * + s;
node[i].id = i;
if(node[i].x == )
a1++;
else if(node[i].x == )
a2++;
else if(node[i].x == )
a3++;
else if(node[i].x == )
a4++;
}
qsort(node, n, sizeof(node[]), cmp);
a1 /= , a2 /= , a3 /= , a4 /= ;
for(i = ; i < n ; i++)
{
if(node[i].x == )
node[i].y = ;
else if(node[i].x == )
{
if(a4 != )
{
node[i].y = ;
a4--;
}
else
node[i].y = ;
}
else if(node[i].x == )
{
if(a3 != )
{
node[i].y = ;
a3--;
}
else
node[i].y = ;
}
else if(node[i].x == )
{
if(a2 != )
{
node[i].y = ;
a2--;
}
else
node[i].y = ;
}
else if(node[i].x == )
{
if(a1 != )
{
node[i].y = ;
a1--;
}
else
node[i].y = ;
}
else
node[i].y = ;
}
qsort(node, n, sizeof(node[]), cmp1);
for(i = ; i < n ; i++)
printf("%d\n", node[i].y);
printf("\n"); }
return ;
}
hdu 1084 What Is Your Grade?的更多相关文章
- HDU 1084 What Is Your Grade?(排序)
题目在这里:1084 题目描述: “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and yo ...
- HDU 1084:What Is Your Grade?
Problem Description "Point, point, life of student!" This is a ballad(歌谣)well known in col ...
- 杭电OJ—— 1084 What Is Your Grade?
What Is Your Grade? Problem Description “Point, point, life of student!” This is a ballad(歌谣)well kn ...
- HDU 1084 - ACM
题目不难,但是需要对数据进行处理,我的代码有些冗长,希望以后能改进... 主要思路是先算总的时间,然后进行对比,将做同样题数的前一半的人筛选出来. /状态:AC/ Description “Point ...
- HDU 5038 Grade(分级)
Description 题目描述 Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of ...
- hdu 5038 求出现次数最多的grade
http://acm.hdu.edu.cn/showproblem.php?pid=5038 模拟水题 求出现次数最多的grade.如果有多个grade出现的次数一样多,且还有其他的grade,则把这 ...
- HDU 5038 Grade北京赛区网赛1005
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5038 解题报告:就是输入n个数w,定义s = 10000 - (100 - w)^2,问s出现频率最高 ...
- HDU 5038 Grade
解题思路:这题最关键的是要读懂题意,If not all the value are the same but the frequencies of them are the same, there ...
- hdu 3666 Making the Grade
题目大意 给出了一列数,要求通过修改某些值,使得最终这列数变成有序的序列,非增或者非减的,求最小的修改量. 分析 首先我们会发现,最终修改后,或者和前一个数字一样,或者和后一个数字一样,这样才能修改量 ...
随机推荐
- Spring3.1新特性介绍
Spring3.1新特性 一.Spring2.5之前,我们都是通过实现Controller接口或其实现来定义我们的处理器类. 二.Spring2.5引入注解式处理器支持,通过@Controller ...
- UVa 1607 (二分) Gates
这道题真的有点“神”啊.= ̄ω ̄= 因为输入都是x,所以整个电路的功能一共就四种:0, 1, x,!x 所以就确定了这样一个事实:如果电路的输出是常数,那么所有的输入都可以优化成常数. 否则,只需要将 ...
- UVa 1611 (排序 模拟) Crane
假设数字1~i-1已经全部归位,则第i到第n个数为无序区间. 如果i在无序区间的前半段,那么直接将i换到第i个位置上. 否则先将i换到无序区间的前半段,再将i归位.这样每个数最多操作两次即可归位. # ...
- Asp.net中的HttpModule和HttpHandler的简单用法
在Asp.net中,HttpModule和HttpHandler均可以截取IIS消息进行处理,这使得我们制作人员能够非常方便的进行诸如图片水印添加,图片盗链检查等功能. 下面先就HttpModule的 ...
- BZOJ 1878 HH的项链
不能分块(显然复杂度会炸啊.....) 离线+BIT.每个颜色在每个询问中只出现一次. #include<iostream> #include<cstdio> #include ...
- 在Datatables中加入错误提示功能
经常用Datatables的童鞋一定碰到过当采用服务端请求的时候,一旦后台出现异常,Datatables的会一直卡在那里,中间的正在处理的提示一直停留着. 为了能给用户更好的体验,需要对Datatab ...
- 定时任务处理-Quartz
Quartz Scheduler,定时任务 Quartz是一个作业调度系统(a job scheduling system),负责在约定的时间到达时执行(或通知)其他软件控制.是一个Java的定时任务 ...
- 【解题报告】HDU -1142 A Walk Through the Forest
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=1142 题目大意:Jimmy要从办公室走路回家,办公室在森林的一侧,家在另一侧,他每天要采取不一样的路线 ...
- GenericRepository
public interface IGenericRepository<TEntity> where TEntity : class { IQueryable<TEntity> ...
- Shell教程5-Shell运算符
Bash 支持很多运算符,包括算数运算符.关系运算符.布尔运算符.字符串运算符和文件测试运算符. 原生bash不支持简单的数学运算,但是可以通过其他命令来实现,例如 awk 和 expr,expr 最 ...