关闭

杭电 1084

443人阅读 评论(0) 收藏 举报

                                        What Is Your Grade?

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4680    Accepted Submission(s): 1382

Problem 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
#include <stdio.h>
int main()
{
    int i,j,n,s,s1,s2;
    int b[110][5],a[110];
    while(scanf("%d",&n)!=EOF)
    {
        if(n<0)
        {
            break;
        }
        for(i=0;i<=n-1;i++)
        {
            scanf("%d",&b[i][0]);
            scanf("%d:%d:%d",&b[i][1],&b[i][2],&b[i][3]);
			a[i]=b[i][1]*3600+b[i][2]*60+b[i][3];
        }
        for(i=0;i<=n-1;i++)
        {
			s1=0;
            if(b[i][0]==5)
            {
                s=100;
            }else if(b[i][0]==4)
            {
                s=90;
            }else if(b[i][0]==3)
            {
                s=80;
            }else if(b[i][0]==2)
            {
                s=70;
            }else if(b[i][0]==1)
            {
                s=60;
            }else
            {
                s=50;
            }
            if(s!=100&&s!=50)
            {
				for(j=0;j<=n-1;j++)
				{
					if(j!=i)
					{
						if(b[i][0]==b[j][0])
						{
							s1+=1;
						}
					}
				}
				s2=0;
				if(s1!=0)
				{
					for(j=0;j<=n-1;j++)
					{
						if(j!=i)
						{
							if(b[i][0]==b[j][0])
							{
								if(a[j]<a[i])
								{
									s2+=1;
									if(s2>=(s1+1)/2)
									{
										break;
									}
								}
							}
						}
					}
					if(j==n)
					{
						s+=5;
					}
				}
            }
            printf("%d\n",s);
        }
        printf("\n");
    }
    return 0;
}


Sample Output
100 90 90 95 100

Author
lcy
0
0

猜你在找
【直播】机器学习&数据挖掘7周实训--韦玮
【套餐】系统集成项目管理工程师顺利通关--徐朋
【直播】3小时掌握Docker最佳实战-徐西宁
【套餐】机器学习系列套餐(算法+实战)--唐宇迪
【直播】计算机视觉原理及实战--屈教授
【套餐】微信订阅号+服务号Java版 v2.0--翟东平
【直播】机器学习之矩阵--黄博士
【套餐】微信订阅号+服务号Java版 v2.0--翟东平
【直播】机器学习之凸优化--马博士
【套餐】Javascript 设计模式实战--曾亮
查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:258436次
    • 积分:6089
    • 等级:
    • 排名:第4088名
    • 原创:337篇
    • 转载:0篇
    • 译文:0篇
    • 评论:10条
    文章分类
    最新评论