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

 
 #include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std; int main()
{
int n;
struct
{
char t[];//time
int p;//problem
int s;//score
}a[];
while((scanf("%d",&n))&&n!=-)
{
for(int i=;i<n;i++)
{
scanf("%d%s",&a[i].p,&a[i].t);
a[i].s=+*a[i].p;
}
int x=;
while(x<)
{
char time[][]={"99:99:99"};
int num=; for(int i=;i<n;i++)
{
if(a[i].p==x)
{
strcpy(time[num++],a[i].t);
}
}
for(int i=;i<num/;i++)
{
for(int j=i+;j<num;j++)
{
if(strcmp(time[i],time[j])>)
{
char p[];
strcpy(p,time[i]);
strcpy(time[i],time[j]);
strcpy(time[j],p);
}
}
}
for(int i=;i<n;i++)
{
if(a[i].p==x&&strcmp(a[i].t,time[num/-])<=)
{
a[i].s+=;
}
}
x++;
}
for(int i=;i<n;i++)
{
printf("%d\n",a[i].s);
}
printf("\n");
}
}

CDZSC_2015寒假新人(1)——基础 i的更多相关文章

  1. CDZSC_2015寒假新人(1)——基础 h

    Description Ignatius was born in a leap year, so he want to know when he could hold his birthday par ...

  2. CDZSC_2015寒假新人(1)——基础 g

    Description Ignatius likes to write words in reverse way. Given a single line of text which is writt ...

  3. CDZSC_2015寒假新人(1)——基础 f

    Description An inch worm is at the bottom of a well n inches deep. It has enough energy to climb u i ...

  4. CDZSC_2015寒假新人(1)——基础 e

    Description Julius Caesar lived in a time of danger and intrigue. The hardest situation Caesar ever ...

  5. CDZSC_2015寒假新人(1)——基础 d

    Description These days, I am thinking about a question, how can I get a problem as easy as A+B? It i ...

  6. CDZSC_2015寒假新人(1)——基础 c

    Description FatMouse prepared M pounds of cat food, ready to trade with the cats guarding the wareho ...

  7. CDZSC_2015寒假新人(1)——基础 b

    Description The highest building in our city has only one elevator. A request list is made up with N ...

  8. CDZSC_2015寒假新人(1)——基础 a

    Description Contest time again! How excited it is to see balloons floating around. But to tell you a ...

  9. CDZSC_2015寒假新人(2)——数学 P

    P - P Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status ...

随机推荐

  1. 《APUE》读书笔记第十一章-线程

    本章主要介绍了线程,了解如何使用多线程在单进程环境中来执行多任务.由于多个线程共享其进程空间,所以必须采用同步的机制来保护数据的一致性. 一.线程的概念 典型的Unix系统都可以看成只有一个控制线程, ...

  2. Js与flash交互:在html页面中用js与MyReport插件交互

    Html页面与flash的加载 如下图,flash是html页面的一个插件节点. js与flash进行交互,首先要处理好html页面和swf的加载问题. Swf调用外部js方法,要确保js方法已存在, ...

  3. Scala学习文档-样本类与模式匹配(match,case,Option)

    样本类:添加了case的类便是样本类.这种修饰符可以让Scala编译器自动为这个类添加一些语法上的便捷设定. //样本类case class //层级包括一个抽象基类Expr和四个子类,每个代表一种表 ...

  4. cocos2d安卓android长音效播放不完全

    是因为安卓限制了音效的内存,一般把mp3的比特率压缩一下.就可以搞定了.

  5. java中byte数组与int类型的转换(两种方式)

    http://blog.csdn.net/z69183787/article/details/38564219 http://blog.csdn.net/z69183787/article/detai ...

  6. find之exec和args

    本来以为以前的差不多够用了.呵呵,看到很多高手用高技巧,心痒痒的觉得我自己还可以提升啊..哈哈哈. 这个实践起来之后,,SED,AWK也得深化一下,,,SHELL和PYTHON,作运维的两样都不能废. ...

  7. adb链接手机调试android应用

    adb链接手机调试android应用 hulk@hulk-Lenovo:~$ adb devices List of devices attached  ???????????? no permiss ...

  8. 【转】Android兼容性测试CTS --环境搭建、测试执行、结果分析

    原文网址:http://www.cnblogs.com/zh-ya-jing/p/4396918.html 为了确保Android应用能够在所有兼容Android的设备上正确运行,并且保持相似的用户体 ...

  9. Shortest Word Distance 解答

    Question Given a list of words and two words word1 and word2, return the shortest distance between t ...

  10. Hive 8、Hive2 beeline 和 Hive jdbc

    1.Hive2 beeline  Beeline 要与HiveServer2配合使用,支持嵌入模式和远程模式 启动beeline 打开两个Shell窗口,一个启动Hive2 一个beeline连接hi ...