现在的位置: 首页 > 综合 > 正文

杭电 1084

2014年09月05日 ⁄ 综合 ⁄ 共 2023字 ⁄ 字号 评论关闭

                                        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

抱歉!评论已关闭.