• 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 }
  • 相关阅读:
    ecshop 调用指定分类的推荐,热卖,新品
    ecshop 首页调用指定类产品
    html常用笔记
    ecshop 修改flash图片大小
    ecshop 删除随机版权
    Java Web(一) Servlet详解!!
    Git使用总结
    git clone命令使用
    Lucene学习总结之四:Lucene索引过程分析
    Lucene学习总结之二:Lucene的总体架构
  • 原文地址:https://www.cnblogs.com/xiongqiangcs/p/3012765.html
Copyright © 2020-2023  润新知