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

Problem Description
“Point, point, life of student!”
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!
 
Input
Input contains multiple test cases. Each test case contains an integer N (1<=N<=100, the number of students) in a line first, and then N lines follow. Each line contains P (0<=P<=5 number of problems that have been solved) and T(consumed 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.
 
Output
Output the scores of N students in N lines for each case, and there is a blank line after each case.
 
Sample Input
4
5 06:30:17
4 07:31:27
4 08:12:12
4 05:23:13
 
1
5 06:30:17
-1
 
Sample Output
100
90
90
95
100
 
不想多解释,水题一道,题没看错就行,这么一道水题我竟wa了很多次,很是忧桑。。。
直接附上代码
 #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?的更多相关文章

  1. HDU 1084 What Is Your Grade?(排序)

    题目在这里:1084 题目描述: “Point, point, life of student!” This is a ballad(歌谣)well known in colleges, and yo ...

  2. HDU 1084:What Is Your Grade?

    Problem Description "Point, point, life of student!" This is a ballad(歌谣)well known in col ...

  3. 杭电OJ—— 1084 What Is Your Grade?

    What Is Your Grade? Problem Description “Point, point, life of student!” This is a ballad(歌谣)well kn ...

  4. HDU 1084 - ACM

    题目不难,但是需要对数据进行处理,我的代码有些冗长,希望以后能改进... 主要思路是先算总的时间,然后进行对比,将做同样题数的前一半的人筛选出来. /状态:AC/ Description “Point ...

  5. HDU 5038 Grade(分级)

    Description 题目描述 Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of ...

  6. hdu 5038 求出现次数最多的grade

    http://acm.hdu.edu.cn/showproblem.php?pid=5038 模拟水题 求出现次数最多的grade.如果有多个grade出现的次数一样多,且还有其他的grade,则把这 ...

  7. HDU 5038 Grade北京赛区网赛1005

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5038 解题报告:就是输入n个数w,定义s = 10000 - (100 - w)^2,问s出现频率最高 ...

  8. HDU 5038 Grade

    解题思路:这题最关键的是要读懂题意,If not all the value are the same but the frequencies of them are the same, there ...

  9. hdu 3666 Making the Grade

    题目大意 给出了一列数,要求通过修改某些值,使得最终这列数变成有序的序列,非增或者非减的,求最小的修改量. 分析 首先我们会发现,最终修改后,或者和前一个数字一样,或者和后一个数字一样,这样才能修改量 ...

随机推荐

  1. jQuery实例-记住登录信息

    本文介绍下jquery 记住登录信息的方法,引入jquery.cookie.js文件,实现记住登录信息,有需要的朋友参考下. 首先,导入jquery.cookie.js $(function(){ / ...

  2. res里面的drawable(ldpi、mdpi、hdpi、xhdpi、xxhdpi)

    (1)drawable-hdpi里面存放高分辨率的图片,如WVGA (480x800),FWVGA (480x854) (2)drawable-mdpi里面存放中等分辨率的图片,如HVGA (320x ...

  3. UVa 11468 (AC自动机 概率DP) Substring

    将K个模板串构成一个AC自动机,那些能匹配到的单词节点都称之为禁止节点. 然后问题就变成了在Tire树上走L步且不经过禁止节点的概率. 根据全概率公式用记忆化搜索求解. #include <cs ...

  4. 搜索浅谈(Elasticsearch和Lucene4分享)

    刚刚过去的双11,真是给线下运营商好好上了一课.当今的互联网真是炙手可热,大家对互联网的热情是如此之高.相信电商之间的竞争将更加的激烈和残酷,不过,搜索,作为用户体验很重要的一点,各大电商也做的越来越 ...

  5. 线程----BlockingQueue (转)

    t java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.ut ...

  6. 格式化输出星期几 C#

    string Today = DateTime.Now.ToString("yyyy-MM-dd dddd",new System.Globalization.CultureInf ...

  7. MySQL · 性能优化· InnoDB buffer pool flush策略漫谈

    MySQL · 性能优化· InnoDB buffer pool flush策略漫谈 背景 我们知道InnoDB使用buffer pool来缓存从磁盘读取到内存的数据页.buffer pool通常由数 ...

  8. 康乐不风流之爱解题的pde灌水王张祖锦

    康乐不风流之爱解题的pde灌水王张祖锦 师弟: 邓洪存 (现在烟台大学任教) 好吧, 我一直想写写康乐园里与我相熟的这几个人, 不如趁此机会开始. 第一批人物为张祖锦.苏延辉.张会春.黄显涛.刘兴兴. ...

  9. Textbox像百度一下实现下拉显示 z

    List<string> Data = new List<string>(); string Randomstr = "功夫撒黑胡椒hcbvf蜂窝qwertyuiop ...

  10. JavaScript/jQuery 表单美化插件小结

    Niceforms Niceforms是一款独立的表单美化工具,当前版本为2.0 官方主页:http://www.emblematiq.com/lab/niceforms/ 官方演示:http://w ...