## 动力学知识库

http://acm.hdu.edu.cn/showproblem.php?pid=1084

Run IDSubmit TimeJudge StatusPro.IDExe.TimeExe.MemoryCode Len.LanguageAuthor42557462011-07-25 22:01:25Accepted10840MS348K1954 BG++GongZi
`//HDOJ 1084 Code By NetBeans 6.9.1#include <iostream>#include <cstdio>#include <memory.h>#include <algorithm>using namespace std;struct STUDTYPE{ int order; int solved_num; long long time; int score;};bool cmp_by_solve_num(STUDTYPE x, STUDTYPE y);bool cmp_by_order(STUDTYPE x, STUDTYPE y);int default_score[6] = {50, 60, 70, 80, 90, 100};int main(){ int N; while(cin >> N && N > 0) { int solved[6]; memset(solved, 0, sizeof(solved)); STUDTYPE stud[N]; for(int i = 0; i < N; ++i) { int h, m, s; scanf("%d %d:%d:%d", &stud[i].solved_num, &h, &m, &s); stud[i].time = h * 3600 + m * 60 + s; stud[i].order = i; solved[stud[i].solved_num]++; } sort(stud, stud + N, cmp_by_solve_num); int first_half[6]; for( int i = 0; i < 6; ++i ) { if( solved[i] == 1 ) { first_half[i] = 1; } else { first_half[i] = solved[i] / 2; } } for( int i = 0; i < N; ++i ) { int num = stud[i].solved_num; stud[i].score = default_score[num]; if( first_half[num] > 0 && num < 5 && num > 0 ) { stud[i].score += 5; first_half[num]--; } } sort(stud, stud + N, cmp_by_order); for(int i = 0; i < N; ++i) { cout << stud[i].score << endl; } cout << endl; } return 0;}bool cmp_by_solve_num(STUDTYPE x, STUDTYPE y){ if(x.solved_num == y.solved_num) { return x.time < y.time; } return x.solved_num > y.solved_num;}bool cmp_by_order(STUDTYPE x, STUDTYPE y){ return x.order < y.order;}#if gongzi#endif`