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
题目大意 给出了一列数,要求通过修改某些值,使得最终这列数变成有序的序列,非增或者非减的,求最小的修改量. 分析 首先我们会发现,最终修改后,或者和前一个数字一样,或者和后一个数字一样,这样才能修改量 ...
随机推荐
- jQuery_效果(淡入淡出)
1.jQuery fadeIn() 方法( 用于淡入已隐藏的元素.) 语法: $(selector).fadeIn(speed,callback); 可选的 speed 参数规定效果的时长.它可以取以 ...
- KVC&KVO&NSNotification
KVC,即是指 NSKeyValueCoding,一个非正式的 Protocol,提供一种机制来间接访问对象的属性.KVO 就是基于 KVC 实现的关键技术之一. 一个对象拥有某些属性.比如说,一个 ...
- JVM——新生代与老年代
首先看在JVM的堆中,按代的划分: Young:主要是用来存放新生的对象. Old:主要存放应用程序中生命周期长的内存对象. Permanent:是指内存的永久保存区域,主要存放Class和Meta的 ...
- mips-linux-gnu-gcc
(1) -lz -lrt -lm -lc都是什么库 libzlibrtlibmlibc然后google之压缩库(Z)实时库(real time)数学库(math)标准C库(C lib) 可以进入/li ...
- Task和BackTask
一.总结性知识点: 1.Android应用运行时会创建任务Task,用于存放主窗口 2.每一个任务包含一个堆栈数据结构,用于保存当前应用已创建的窗口对象,这个堆栈即回退栈BackSta ...
- 构建 XCache 的基本步骤
构建 XCache 的基本步骤 在开始之前,首先确保 PHP 正常安装并核实 phpize 是否位于 shell 的 PATH 下.同时,还需要一个 C 编译器,例如 GNU Compiler Col ...
- 编辑时snapping的添加
原文 编辑时snapping的添加 注意需要在编辑模式下进行snapping的添加(也即先需要使用IEngineEditor进入编辑状态): IMapControl3 mMap = (IMapCont ...
- 14、NFC技术:使用Android Beam技术传输文本
Android Beam的基本理念 Android Beam的基本理念就是两部(只能是两部)NFC设备靠近时(一般是背靠背),通过触摸一部NFC设备的屏幕,将数据推向另外一部NFC设备.在传递数据的过 ...
- 第一个UI脚本--python+selenium
之前一直是用java+selenium做自动化测试的,最近因为工作需要,需要用pyhton+selenium去实现,于是就赶驴上架,熟悉了一下python的语法和脚本的编写过程,下面是一个简单的脚本, ...
- 转:使用 JMeter 完成常用的压力测试
使用 JMeter 完成常用的压力测试 就目前 Java EE 的平台下开发的软件来说,这种节点通常可能是:Web 服务器.数据库服务器和 JMS 服务器.它们都是请求主要发生的地点,请求频率较其它的 ...