HDU 1084 - What Is Your Grade?

给出第 i 个学生做完的题数和时间,给学生打分

排个序就行了吧

 1 #include <iostream>
 2 #include <cstdio>
 3 #include <algorithm>
 4 #include <cstring>
 5 using namespace std;
 6 const int N=105;
 7 struct stu{
 8     int h,m,s,num,sco;
 9 }a[10][N];
10 int n,m[N],p,h,mm,s,ans[N];
11 bool cmp(stu a,stu b)
12 {
13     if(a.h==b.h)
14     {
15         if(a.m==b.m) return a.s<b.s;
16         return a.m<b.m;
17     }
18     return a.h<b.h;
19 }
20 void fuc(stu a[],int m,int t)
21 {
22     for(int i=1;i<=m;i++)
23     {
24         if(i<=m/2) ans[a[i].num]=t+5;
25         else ans[a[i].num]=t;
26     }
27 }
28 int main()
29 {
30     while(~scanf("%d",&n)&&n!=-1)
31     {
32         memset(m,0,sizeof(m));
33         for(int i=1;i<=n;i++)
34         {
35             scanf("%d %d:%d:%d",&p,&h,&mm,&s);
36             m[p]++;
37             a[p][m[p]].num=i;
38             a[p][m[p]].h=h;
39             a[p][m[p]].m=mm;
40             a[p][m[p]].s=s;
41         }
42         for(int i=1;i<=4;i++) sort(a[i]+1,a[i]+m[i]+1,cmp);
43         for(int i=1;i<=m[0];i++) ans[a[0][i].num]=50;
44         for(int i=1;i<=m[5];i++) ans[a[5][i].num]=100;
45         for(int i=1;i<=4;i++) fuc(a[i],m[i],10*i+50);
46         for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
47         puts("");
48     }
49 }
时间: 2024-08-19 02:20:03

HDU 1084 - What Is Your Grade?的相关文章

HDU 1084 [What Is Your Grade?] 结构体排序

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1084 题目大意:共5道题,N个学生.做出5道满分,0道50分.做出1-4道的同学,若在前50%(向下取整),则获得95.85.75.65,若在后50%则获得90.80.70.60. 关键思想:结构体排序 //结构体排序,考虑边界 #include <iostream> #include <algorithm> #include <cmath> #include <me

HDU 1048 What Is Your Grade? (简单模拟)

 What Is Your Grade? 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

HDU 1084 - ACM

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

HDU 5038 Grade(数学)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5038 Problem Description Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of mushrooms and ask him to grade each mushroom according to its weight. Suppose the weight of a m

hdu 5038 Grade

Grade Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 360    Accepted Submission(s): 203 Problem Description Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of

hdu 5038 Grade(简单模拟求解)2014 ACM/ICPC Asia Regional 北京 Online

Grade                                                                     Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Problem Description Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives h

HDU 5038 Grade北京赛区网赛1005

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5038 解题报告:就是输入n个数w,定义s = 10000 - (100 - w)^2,问s出现频率最高的是哪些,当所有的不同的s出现频率相同时,输出Bad Mushroom,当s只有一种时,直接输出. 1 #include<cstdio> 2 #include<cstring> 3 #include<iostream> 4 #include<algorithm>

hdu 5038 Grade(水)

题目链接: huangjing 思路: 这个题目应该随便怎么搞都可以,我说一下我的思路,可以根据题目的数据计算出价值的取值范围为0~10000,所以用一个1w的数组表示数组,下标代表价值,数组值代表数目, 然后这个题目要特判一下全是一样的值的情况. 题目: Grade Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 297    A

[ACM] hdu 5038 Grade

Grade Problem Description Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of mushrooms and ask him to grade each mushroom according to its weight. Suppose the weight of a mushroom is w, then it's grade s is s = 10000 -