HDU 1084 What Is Your Grade?

 1 #include <iostream>
 2 #include <vector>
 3 #include <algorithm>
 4 #include <string>
 5 #define MAX 200
 6 using namespace std;
 7 
 8 struct stu{
 9     int id;
10     string time;
11 };
12 
13 bool cmp(stu a,stu b){
14     return a.time<b.time;
15 }
16 
17 int main(){
18     int n;
19     while(cin >> n && n >=0 ){
20         vector<stu> problemNum[6];
21         for(int i = 1; i <= n; i ++ ){
22             int num;
23             cin >> num;
24             stu tmp;
25             tmp.id = i;
26             cin >> tmp.time;
27             problemNum[num].push_back(tmp);
28         }
29         int score[MAX]={0};
30         for(int i = 0; i <= 5 ; i++){
31             sort(problemNum[i].begin(),problemNum[i].end(),cmp);
32             for(int j = 0; j < problemNum[i].size()/2; j ++ ){
33                 if(i == 0) score[problemNum[i][j].id ]= 50;
34                 else if( i == 1) score[problemNum[i][j].id] = 65;
35                 else if( i == 2) score[problemNum[i][j].id] = 75;
36                 else if( i == 3) score[problemNum[i][j].id] = 85;
37                 else if( i == 4) score[problemNum[i][j].id] = 95;
38                 else score[problemNum[i][j].id] = 100;
39             }
40             for(int j = problemNum[i].size()/2; j < problemNum[i].size(); j ++ ){
41                 if(i == 0) score[problemNum[i][j].id ]= 50;
42                 else if( i == 1) score[problemNum[i][j].id] = 60;
43                 else if( i == 2) score[problemNum[i][j].id] = 70;
44                 else if( i == 3) score[problemNum[i][j].id] = 80;
45                 else if( i == 4) score[problemNum[i][j].id] = 90;
46                 else score[problemNum[i][j].id] = 100;
47             }
48         }
49         for(int i = 1; i <= n ; i ++ ) cout<< score[i]<<endl;
50         cout<<endl;
51     }
52     return 0;
53 }

 

posted @ 2013-04-10 17:22  OpenSoucre  阅读(152)  评论(0编辑  收藏  举报