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. QWidget使用qss样式的background-image属性

    最近在学习Qt使用QSS样式美化窗口部件的内容.发现在对QWidget应用background-image改变窗口背景图片时,QWidget的窗口背景并未生效.工程建立如下:    1.新建 Qt A ...

  2. uva 10061 How many zero's and how many digits ?

    How many zeros and how many digits? Input: standard input Output: standard output Given a decimal in ...

  3. ubuntu下查看IP Gateway DNS信息

    使用nm-tool命令 在最底下有一行: IPv4 Settings: Address: 192.168.0.166 Prefix: (255.255.255.0) Gateway: 192.168. ...

  4. Powershell环境变量

    Powershell环境变量 9 12月, 2011  在 Powershell tagged 变量by Mooser Lee 本文索引 [隐藏] 1读取特殊的环境变量 2查找环境变量 3创建新的环境 ...

  5. HDU1841——KMP算法

    这个题..需要对KMP的模板理解的比较透彻,以前我也只是会套模板..后来才知道..之会套模板是不行的..如果不能把握模板的每一个细节`,至少能搞清楚模板的每一个模块大体是什么意思.. 题意是给出两个串 ...

  6. 数据库--PHP环境搭建

    一: 1.PHP的架构 LAMP :Linux  阿帕奇  MySQL  PHP WAMP:Linux 阿帕奇  Mysql  PHP (集成的环境搭建软件),一键搭建PHP开发环境工具 2.修改数据 ...

  7. 值传递 & 引用传递

    以下程序的输出结果是? public class Example { String str = new String("good"); char[] ch = { 'a', 'b' ...

  8. hdu 5642 King's Order(数位dp)

    Problem Description After the king's speech , everyone is encouraged. But the war is not over. The k ...

  9. jquery ajax 局部table 刷新技术

    点击查询:

  10. python多字符中找出最大匹配(网友处学习)

    #如'abbcc','abbdd' 找到abba='abbcc'b='abbdd'from difflib import *s=SequenceMatcher(None,a,b)m=s.find_lo ...