。。。
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <stdlib.h>
using namespace std;
struct students
{
int AC;
char time[20];
};
typedef struct students stu;
bool cmp(stu *A,stu *B)
{
int i;
if(strcmp(A->time,B->time) < 0) return true;
else return false;
}
int main()
{
int N;
while (cin >> N and N != -1)
{
stu STU[110];
int grade[110]={};
for(int i = 0; i < N; i++) scanf("%d %s",&STU[i].AC,STU[i].time);
for(int i = 0; i < N; i++)
{
if(STU[i].AC == 5) grade[i] = 100;
else if (STU[i].AC == 0) grade[i] = 50;
else
{
if(!grade[i])
{
stu *temp[110];
int count = 0;
for(int j = i ; j < N; j++)
{
if(STU[j].AC == STU[i].AC)//找出题数相同的。
temp[count++] = &STU[j];
}
sort(temp,temp+count,cmp);//排序
for(int j = 0; j < count; j++)
{
grade[temp[j] - STU] = 50 + 10 * temp[j] -> AC;
if(j < count / 2) grade[temp[j] - STU] += 5;
}
}
}
}
for(int i = 0; i < N; i++) cout << grade[i] << endl;
cout << endl;
}
return 0;
}