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. ylb:事务处理

    ylbtech_sqlserver --1.定义三个变量分别保存你的姓名,年龄和身高,然后赋值并且输出 --DECLARE @name varchar(10) , @age int , @height ...

  2. ASP.NET MVC学习---(二)EF文件结构

    之前已经简单的介绍过ORM框架和EF 也了解了EF的种种优点 那么这个EF到底长啥样子都还没见过呢 别着急 接下来,科学教育频道--走近科学 带你走进EF的内心世界~ 那么接下来就是~ 等等等等... ...

  3. selenium模拟键盘操作

    单键 /** * 模拟键盘回车事件 * @throws AWTException */ public void KeyEventEnter() throws AWTException { Robot ...

  4. Nginx常用Rewrite(伪静态规则)WordPress/PHPCMS/ECSHOP/ShopEX/SaBlog/Discuz/DiscuzX/PHPWind/Typecho/DEDECMS

    目前已收集Wordpress.Wordpress二级目录.PHPCMS.ECSHOP.ShopEX.SaBlog.Discuz.Discuz X.PHPWind.Typecho.DEDECMS: Wo ...

  5. SQLite使用事务

    关键代码 SQLiteDatabase db = myDataHelper.getWritableDatabase(); // 开启事务 db.beginTransaction(); try{ db. ...

  6. eclispe查看jdk源码后特别卡顿导致未响应解决

    第一步:Eclipse -> Preferences -> General -> Startup and Shutdown.不要勾选 RSE UI. 第二步:Eclipse -> ...

  7. vue-router 动态路由匹配

    export default new Router({ routes: [ { path: '/', name: 'HelloWorld', component: HelloWorld, }, { / ...

  8. TCP/IP详解 卷一(第十九章 TCP的交互数据流)

    TCP需要同时处理两类数据:块数据.交互数据. 本章将以Rlogin应用为例观察交互数据的传输过程. 交互式输入 首先观察在一个Rlogin连接上键入一个交互命令时所产生的数据流(每键入一个交互按键都 ...

  9. linux 命令笔记: iptables

    配置虚拟机网卡 NAT 联网: iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -j MASQUERADE iptables -A FROWARD - ...

  10. 【Python数据分析】

    索引对象的其他功能 ①更换索引 ②对齐 ③删除 一.更换索引 我们已经知道,数据结构一旦声明,index对象就不能改变 事实上,我们重新定义索引之后,我们就能够用现有的数据结构生成一个新的数据机构 p ...