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
题目大意 给出了一列数,要求通过修改某些值,使得最终这列数变成有序的序列,非增或者非减的,求最小的修改量. 分析 首先我们会发现,最终修改后,或者和前一个数字一样,或者和后一个数字一样,这样才能修改量 ...
随机推荐
- website project team member 角色及开发过程概念图
一个web项目的团队往往具有以下角色的人员组成: project stakeholder(client or business owner)产品经理 Project manager 项目经理 prod ...
- 安卓WebView中接口隐患与手机挂马利用(远程命令执行)
安卓应用存在安全漏洞,浏览网站打开链接即可中招.目前有白帽子提交漏洞表明目前安卓平台上的应用普遍存在一个安全漏洞,用户打开一个链接就可导致远程安装恶意应用甚至完全控制用户手机,目前微信,手机QQ,QV ...
- poj 1659 Frogs' Neighborhood(出入度、可图定理)
题意:我们常根据无向边来计算每个节点的度,现在反过来了,已知每个节点的度,问是否可图,若可图,输出一种情况. 分析:这是一道定理题,只要知道可图定理,就是so easy了 可图定理:对每个节点的度从 ...
- HDU 3342 Legal or Not (图是否有环)
题意: 给出n个人的师徒关系,如有 a是b的师傅,b是c的师傅,c是a的师傅,这样则不合法,输出NO,否则输出YES. 思路: 每段关系可以看成一条有向边,从师傅指向徒弟,那么徒弟的徒子徒孙都不可能再 ...
- 原型设计工具Axure 建模工具powerdesigner
Licensee:IloveyouAxure Key:UChpuxwbDW6eAIaAf9UujEFSBwN3vpEz9snHvlCQVJGQy4p7WrCyKLLvV5QLvqva 注册用户名: ...
- spm中头动绘图的理解,自带数据集
1.在得到头动评估的数据基础上,可以汇出头动变化的折线图. 运行本程序需要下载相应的实例数据 headmove_data.txt 头动是fMRI的一个重要问题,该程序画出了某个被试进行扫描时头动的具体 ...
- gridview自定义表头
gridview为我们提供了丰富的接口,用于满足自定义需求. 通常asp:gridview会根据绑定的列Columns自动生成表头,展现在前台元素. 序号 类别 有时候需要复杂一些的表头. 序号 类别 ...
- HDU 3183 A Magic Lamp
直接模拟 如果后一位比前一位小,那就一直 向前 pop()掉 维护他单调递增: #include<iostream> #include<cstring> #include& ...
- Android 动画 6问6答
1.view 动画有哪些需要注意的? 答:view动画 本身比较简单.http://www.cnblogs.com/punkisnotdead/p/5179115.html 看这篇文章的第五问就可以了 ...
- SQL注入常用语句
整形参数判断 1.直接加' 2.and 1=1 3. and 1=2 如果1.3运行异常 2正常就存在注入 字符型判断 1.直接加' 2.and '1'='1' 3. ...