#include <iostream> #include <algorithm> using namespace std; const int SIZE = 101; typedef struct /*结构体,用于存储输入的数据*/ { int solved; /*解决问题的数目*/ int located; /*学生的位置*/ int h, m, s; /*所花费的时间*/ int soc; /*最终的成绩*/ }time; bool cmp(time &bi1, time &bi2) /*比较函数,用于排序*/ { if (bi1.h > bi2.h) return false; else if (bi1.h < bi2.h) return true; else { if (bi1.m > bi2.m) return false; else if (bi1.m < bi2.m) return true; else { if (bi1.s > bi2.s) return false; else if (bi1.s < bi2.s) return true; } } } int main() { int num; time stu[SIZE]; time sortArr[4][SIZE]; int p, q , r, k, i; while((cin >> num) && (num >= 0)) { p = q = r = k = 0; for (i = 0; i < num; i++) { cin >> stu[i].solved; scanf ("%d:%d:%d", &stu[i].h, &stu[i].m, &stu[i].s); stu[i].located = i; /*记录下输入时的位置*/ /*下面的思路就是:分数能处理的就处理,如解决了5道题(100)和0道题(50) 不能处理的话,我们先将该数分类存入一个数组,之后再做处理 */ if (stu[i].solved == 5) { stu[i].soc = 100; } if (stu[i].solved == 4) { sortArr[0][p] = stu[i]; p++; } if (stu[i].solved == 3) { sortArr[1][q] = stu[i]; q++; } if (stu[i].solved == 2) { sortArr[2][r] = stu[i]; r++; } if (stu[i].solved == 1) { sortArr[3][k] = stu[i]; k++; } if (stu[i].solved == 0) { stu[i].soc = 50; } } if (p >= 1) { sort (sortArr[0], sortArr[0] + p, cmp); /*先排序,按照耗时从小到大排序*/ for (i = 0; i < p / 2; i++) /*前半部分得高分*/ { stu[sortArr[0][i].located].soc = 95; } for (; i < p; i++) /*后半部分得低分*/ { stu[sortArr[0][i].located].soc = 90; } } /*以下类似*/ if (q >= 1) { sort (sortArr[1], sortArr[1] + q, cmp); for (i = 0; i < q / 2; i++) { stu[sortArr[1][i].located].soc = 85; } for (; i < q; i++) { stu[sortArr[1][i].located].soc = 80; } } if (r >= 1) { sort (sortArr[2], sortArr[2] + r, cmp); for (i = 0; i < r / 2; i++) { stu[sortArr[2][i].located].soc = 75; } for (; i < r; i++) { stu[sortArr[2][i].located].soc = 70; } } if (k >= 1) { sort (sortArr[3], sortArr[3] + k, cmp); for (i = 0; i < k / 2; i++) { stu[sortArr[3][i].located].soc = 65; } for (; i < k; i++) { stu[sortArr[3][i].located].soc = 60; } } for (i = 0; i < num; i++) { cout << stu[i].soc << endl; } cout << endl; } system ("pause"); return 0; }