E - What Is Your Grade?
E - What Is Your Grade?
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Description
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
A test case starting with a negative integer terminates the input and this test case should not to be processed.
Output
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?的更多相关文章
- 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 ...
- POJ 3666 Making the Grade
Description A straight dirt road connects two fields on FJ's farm, but it changes elevation more tha ...
- 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 ...
- POJ3666Making the Grade[DP 离散化 LIS相关]
Making the Grade Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6445 Accepted: 2994 ...
- [CareerCup] 15.7 Student Grade 学生成绩
15.7 Imagine a simple database storing information for students' grades. Design what this database m ...
- 英语语法 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 ...
- FPGA speed grade
Altera的-6.-7.-8速度等级逆向排序,Xilinx速度等级正向排序. 不很严密地说,“序号越低,速度等级越高”这是Altera FPGA的排序方法, “序号越高,速度等级也越高”这是Xili ...
- HDU 5038 Grade(分级)
Description 题目描述 Ted is a employee of Always Cook Mushroom (ACM). His boss Matt gives him a pack of ...
- hdu---(5038)Grade(胡搞)
Grade Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Sub ...
- A-Making the Grade(POJ 3666)
Making the Grade Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 4656 Accepted: 2206 ...
随机推荐
- 2017.4.7 java异常处理总结
目录 1.java异常处理的几种错误做法 2.异常处理示例 3.常用异常 4.异常类的继承关系 5.异常处理机制 6.Throw和Throws的区别 7.e.toString(), e.getCaus ...
- ionic准备之angular基础———服务provider 和 factory和service(9)
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Python内置模块和第三方模块
1.Python内置模块和第三方模块 内置模块: Python中,安装好了Python后,本身就带有的库,就叫做Python的内置的库. 内置模块,也被称为Python的标准库. Python 2.x ...
- webcat——基于netty的http和websocket框架
代码地址如下:http://www.demodashi.com/demo/12687.html Webcat是一个基于netty的简单.高性能服务端框架,目前提供http和websocket两种协议的 ...
- JDBC编程理论知识(1)
1.SUN公司为统一对数据库的操作,定义了一套Java操作数据库的规范,称之为JDBC 2.JDBC全称为:Java Data Base Connectivity(java数据库连接),它主要由接口组 ...
- 随想录(做自己代码的測试project师)
[ 声明:版权全部.欢迎转载,请勿用于商业用途. 联系信箱:feixiaoxing @163.com] 非常多project师都有一个不好的习惯,由于大多数itproject师都喜欢写代码.可是不喜欢 ...
- Servlet的API(二)
web服务器收到客户端的http请求,会针对每一次请求,分别创建一个用于代表请求的request对象和代表响应的response对象.request和response对象既然代表请求和响应,那我们获取 ...
- 安装pydot及importError解决办法
安装pydot: 需要先安装graphviz和pyparsing. 安装pydot过程曾出现“import error” 错误,主要是版本不兼容的问题.之后自己apt-get upgrade了一下,问 ...
- delphi的字节对齐
如果不改编译选项Delphi的Record默认也是4字节对齐的. 可以用编译开关指定 {$A4+}就是4字节对齐.同理{$A2+}.{$A1+}等.{$A1+}等同于Packed Record 主要容 ...
- DASH简介及使用方法(FFmpeg, MP4Box)
DASH 为什么选择DASH YouTube采用DASH!其网页端及移动端APP都使用了DASH.DASH的其他采用者包括:Netflix, Hulu, … 什么是DASH 一种服务端.客户端的流媒体 ...