E - What Is Your Grade?

Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

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 //题目意思搞了好久才懂,不懂英语真难玩啊。
有点类似ACM排名
第一行代表有多少个人,然后是每个人的成绩,做了几个题,用时多少。做了5个,不管用时,都是100,少做1个扣10分,没做不管用时都是50分,做了相同题目的,用时排在一半之前加5分,例如 4个人都做4个,前两个 95分,后两个 90 分, 3个人做 4 个,只有第一个 95 分,后两个90分。 //可以dp,可以模拟,然后我果断选了模拟。。。
有几重循环,竟然还是 0ms 有点惊讶
 #include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std; struct People
{
int num;
int t;
int h,m,s;
int fen;
}people[]; int cmp(People a,People b)
{
if (a.t!=b.t)
return a.t>b.t; if (a.h!=b.h) //用时少在前面
return a.h<b.h;
if (a.m!=b.m)
return a.m<b.m;
return a.s<b.s;
} int main()
{
int n;
int i,j,k;
while (scanf("%d",&n)!=EOF)
{
if (n<) break; for (i=;i<=n;i++)
{
scanf("%d %d:%d:%d",&people[i].t,&people[i].h,&people[i].m,&people[i].s);
people[i].num=i;
}
sort(people+,people+n+,cmp); for (i=;i<=n;i++)
{
if (people[i].t!=)
break;
else
people[i].fen=;
} int star=i; for (i=;i>=;i--)//做题数
{
for (j=star;j<=n;j++) //找到做题数相同的一块 str - (j-1)
if (people[j].t!=i)
break; int mid=(star+j-)/;
if ((star+j-)%==)
mid--; for (k=star;k<j;k++)
{
if (k<=mid)
people[k].fen=+i*+;
else
people[k].fen=+i*;
}
star=j;
if (star>n) break;
} for (j=star;j<=n;j++) people[j].fen=; if (n==&&people[].t!=&&people[].t!=) people[].fen+=; for (i=;i<=n;i++)
{
for (j=;j<=n;j++)
{
if (people[j].num==i)
{
printf("%d\n",people[j].fen);
break;
}
}
}
printf("\n");
}
return ;
}

E - What Is Your Grade?的更多相关文章

  1. kaungbin_DP S (POJ 3666) Making the Grade

    Description A straight dirt road connects two fields on FJ's farm, but it changes elevation more tha ...

  2. POJ 3666 Making the Grade

    Description A straight dirt road connects two fields on FJ's farm, but it changes elevation more tha ...

  3. CF719C. Efim and Strange Grade[DP]

    C. Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input sta ...

  4. POJ3666Making the Grade[DP 离散化 LIS相关]

    Making the Grade Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6445   Accepted: 2994 ...

  5. [CareerCup] 15.7 Student Grade 学生成绩

    15.7 Imagine a simple database storing information for students' grades. Design what this database m ...

  6. 英语语法 It all started the summer before second grade when our moving van pulled into her neighborhood

    It all started the summer before second grade when our moving van pulled into herneighborhood It all ...

  7. FPGA speed grade

    Altera的-6.-7.-8速度等级逆向排序,Xilinx速度等级正向排序. 不很严密地说,“序号越低,速度等级越高”这是Altera FPGA的排序方法, “序号越高,速度等级也越高”这是Xili ...

  8. HDU 5038 Grade(分级)

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

  9. hdu---(5038)Grade(胡搞)

    Grade Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Sub ...

  10. A-Making the Grade(POJ 3666)

    Making the Grade Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 4656   Accepted: 2206 ...

随机推荐

  1. html 打印代码,支持翻页

    ylbtech_html_print html打印代码,支持翻页 <html> <head> <meta name=vs_targetSchema content=&qu ...

  2. JAVA中几种常见集合的使用实例

    Java.util.ArrayList(类): *;import java.util.*;public class CollectionTest{//List是一个能包含重复元素的已排序的Collec ...

  3. C++ 获取URL图片、html文件,CInternetSession 【转】

    http://blog.csdn.net/gnixuyil/article/details/7688439 获取网络图片 CString URL="http://www.google.com ...

  4. nginx静态资源配置

    解决EE工程中静态文件显示问题 在工程中本地测试没有问题,发现使用nginx配置了路径的页面,会获取不到相应页面的静态文件问题 静态文件的路径类似为: http://localhost:8080/sa ...

  5. Vue 事件修饰符 阻止默认事件

    阻止默认事件: <a v-on:click.prevent="doThat"></a>

  6. UVA 617 - Nonstop Travel(数论+暴力枚举)

    题目链接:617 - Nonstop Travel 题意:给定一些红绿灯.如今速度能在30-60km/h之内,求多少个速度满足一路不遇到红灯. 思路:暴力每个速度,去推断可不能够,最后注意下输出格式就 ...

  7. 【BIEE】04_当维度表中的维不存在事实表中,需要展示所有维度并且数据类展示为0

    有时候,我们往往会存在这样的需求 例如:事实表的数据如下 EMP_FACT表示事实表,DIM_LEVEL是维度表 预期效果:(根据员工信息,分析各等级员工工资与员工个数) 我们在BIEE报表中新建报表 ...

  8. 如何在aspx页面中使用ascx控件(用户自定义的一个控件)?

    aspx是页面文件ascx是用户控件,用户控件必须嵌入到aspx中才能使用. ascx是用户控件,相当于模板 其实ascx你可以理解为Html里的一部分代码,只是嵌到aspx里而已,因为aspx内容多 ...

  9. Devops成功的八大炫酷工具

    原文链接:http://www.infoworld.com/article/3031009/devops/8-more-cool-tools-for-devops-success.html 为自动化和 ...

  10. shader之旅-7-平面阴影(planar shadow)

    根据<real-time shadow>这本书第二章中的推导,实现了最简单的阴影技术. planar shadow通过一个投影矩阵将被灯光照射的物体的顶点沿着光线方向投影到接受阴影的平面. ...