zoukankan      html  css  js  c++  java
  • 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 }
  • 相关阅读:
    crm 4 注释与上传附件权限
    动态图片轮播
    PHP 连接 MSSQL
    php mssql 中文各种乱码
    百度地图逆地址解析
    Microsoft Visual C++ 2015 Redistributable(x64)
    服务器 vps 空间
    Python之路【第二篇】:Python基础(二)
    Python之路【第一篇】:Python简介和入门
    2016年会成为Java EE微服务年吗?
  • 原文地址:https://www.cnblogs.com/xiongqiangcs/p/3012765.html
Copyright © 2011-2022 走看看