zoukankan      html  css  js  c++  java
  • 1137 Final Grading (25 分)

    1137 Final Grading (25 分)
     

    For a student taking the online course "Data Structures" on China University MOOC (http://www.icourse163.org/), to be qualified for a certificate, he/she must first obtain no less than 200 points from the online programming assignments, and then receive a final grade no less than 60 out of 100. The final grade is calculated by 0 if Gmidterm​​>Gfinal​​, or Gfinal​​ will be taken as the final grade G. Here Gmidterm​​ and Gfinal​​ are the student's scores of the mid-term and the final exams, respectively.

    The problem is that different exams have different grading sheets. Your job is to write a program to merge all the grading sheets into one.

    Input Specification:

    Each input file contains one test case. For each case, the first line gives three positive integers: P , the number of students having done the online programming assignments; M, the number of students on the mid-term list; and N, the number of students on the final exam list. All the numbers are no more than 10,000.

    Then three blocks follow. The first block contains P online programming scores Gp​​'s; the second one contains M mid-term scores Gmidterm​​'s; and the last one contains N final exam scores Gfinal​​'s. Each score occupies a line with the format: StudentID Score, where StudentID is a string of no more than 20 English letters and digits, and Score is a nonnegative integer (the maximum score of the online programming is 900, and that of the mid-term and final exams is 100).

    Output Specification:

    For each case, print the list of students who are qualified for certificates. Each student occupies a line with the format:

    StudentID Gp​​ Gmidterm​​ Gfinal​​ G

    If some score does not exist, output "−" instead. The output must be sorted in descending order of their final grades (G must be rounded up to an integer). If there is a tie, output in ascending order of their StudentID's. It is guaranteed that the StudentID's are all distinct, and there is at least one qullified student.

    Sample Input:

    6 6 7
    01234 880
    a1903 199
    ydjh2 200
    wehu8 300
    dx86w 220
    missing 400
    ydhfu77 99
    wehu8 55
    ydjh2 98
    dx86w 88
    a1903 86
    01234 39
    ydhfu77 88
    a1903 66
    01234 58
    wehu8 84
    ydjh2 82
    missing 99
    dx86w 81
    

    Sample Output:

    missing 400 -1 99 99
    ydjh2 200 98 82 88
    dx86w 220 88 81 84
    wehu8 300 55 84 84
    
     
    也就是个模拟题,挺简单了。
     
     1 #include <bits/stdc++.h>
     3 using namespace std;
     4 int n,m,k;
     5 string s;
     6 double an;
     7 struct Node{
     8     string st;
     9     double assign;
    10     double mid, final;
    11     int g;
    12     friend bool operator < (const Node &a, const Node &b){
    13         return a.g==b.g?(a.st+b.st)<(b.st+a.st):a.g>b.g;
    14     }
    15 }node[10006];
    16 int pos = 0;
    17 map<string,int> mp;
    18 int main(){
    19     cin >> n >> m >> k;
    20     for(int i = 0 ; i < n; ++i){
    21         cin >> s >> an;
    22         if(an < 200) continue;
    23         mp[s] = ++pos;
    24         node[pos].st = s;
    25         node[pos].assign = an;
    26         node[pos].mid = node[pos].final = node[pos].g = -1;
    27     }
    28     for(int i = 0 ; i < m; ++i){
    29         cin >> s >> an;
    30         if(mp[s] != 0){
    31             int ans = mp[s];
    32             node[ans].mid = an;
    33         }
    34     }
    35     for(int i = 0 ; i < k; ++i){
    36         cin >> s >> an;
    37         if(mp[s] != 0){
    38             int ans = mp[s];
    39             node[ans].final = an;
    40             if(node[ans].assign >= 200){
    41                 if(node[ans].mid > node[ans].final){
    42                     node[ans].g = int(node[ans].mid*0.4+node[ans].final*0.6+0.5);
    43                 }else{
    44                     node[ans].g = int(node[ans].final);
    45                 }
    46             }
    47         }
    48     }
    49     sort(node+1,node+pos+1);
    50     for(int i = 1; i <= pos; ++i){
    51         if(node[i].g >= 60){
    52             cout<<node[i].st<<" "<<node[i].assign<<" "<<node[i].mid<<" "<<node[i].final<<" "<<node[i].g<<endl;
    53         }
    54     }
    57     return 0;
    58 }
     
     
     
     
     
  • 相关阅读:
    五大Java开源论坛
    mysql limit,offset 区别
    查询某个字段存在于哪几个表
    C++分享笔记:5X5单词字谜游戏设计
    Linux分享笔记:系统状态检测命令小结
    Linux分享笔记:查看帮助命令 & 常用系统工作命令
    数据结构(C语言)分享笔记:数据结构的逻辑层次、存储层次
    Linux分享笔记:shell终端的介绍
    Java开发学生管理系统
    JAVA使用JDBC连接,修改MySQL数据库(比较乱)
  • 原文地址:https://www.cnblogs.com/zllwxm123/p/11296137.html
Copyright © 2011-2022 走看看