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. C++中的cout输出机制

    代码: #include <iostream> using namespace std; int hello(){ cout<<"hello"<< ...

  2. 有关service

    在symfony2 服务注入容器的时候参数语法可以是这样: cellcom.twig.menu_extension: class: Cellcom\WebBundle\Twig\Extension\M ...

  3. 使用spool命令从Oracle导出数据

    公司的网站用的是Oracle数据库,最近要导出里面的数据,使用mysql数据库 spool D:\DB\{文件名}.sql set heading off; set echo off; set fee ...

  4. 分数(有理数)的四则运算PAT1088

    2015-02-05 PAT- B1088. Rational Arithmetic (20) http://www.patest.cn/contests/pat-a-practise/1088 #i ...

  5. EF数据迁移(当模型改变时更新数据库)

    https://msdn.microsoft.com/zh-CN/data/jj591621 Enable-Migrations Add-Migration 名称 Update-Database –V ...

  6. JDK PATH 和 CLASSPATH环境变量的作用及其配置

    (1)PATH环境变量的作用 在安装JDK程序之后,在安装目录下的bin目录中会提供一些开发Java程序时必备的工具程序. 对于Java的初学者,建议在命令符模式下使用这些工具程序编译运行Java程序 ...

  7. Win8.1 MSDN各版本下载(64位/32位,简体中文,繁体中文,英文),X86&X64,EN,CHS,CHT

    英文64位ed2k://|file|en_windows_8_1_x64_dvd_2707217.iso|3899295744|8E604054013D21209B851E41DC19F6F5|/ 英 ...

  8. Ghost源代码

    http://download.csdn.net/download/xiaoshuai0101/4739231 彻底的掩藏磁盘,让病毒和破坏的人没有一点办法上传者 guizhoutiger

  9. 《Programming WPF》翻译 第5章 4.元素类型样式

    原文:<Programming WPF>翻译 第5章 4.元素类型样式 命名样式非常有用,当你得到一组属性并应用到特点的元素上.然而,如果你想要应用一个统一的样式到所有确定元素类型的实例, ...

  10. boost库使用:vs2013下boost::container::vector编译出错解决

    boost版本:boost_1_55_0 bug报告地址 https://svn.boost.org/trac/boost/ticket/9332 出错信息 has_member_function_c ...