博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
题目1014:排名
阅读量:4358 次
发布时间:2019-06-07

本文共 1664 字,大约阅读时间需要 5 分钟。

题目描述:
    今天的上机考试虽然有实时的Ranklist,但上面的排名只是根据完成的题数排序,没有考虑每题的分值,所以并不是最后的排名。给定录取分数线,请你写程序找出最后通过分数线的考生,并将他们的成绩按降序打印。
输入:

    测试输入包含若干场考试的信息。每场考试信息的第1行给出考生人数N ( 0 < N < 1000 )、考题数M ( 0 < M < = 10 )、分数线(正整数)G;第2行排序给出第1题至第M题的正整数分值;以下N行,每行给出一名考生的准考证号(长度不超过20的字符串)、该生解决的题目总数m、以及这m道题的题号(题目号由1到M)。 

    当读入的考生人数为0时,输入结束,该场考试不予处理。

输出:

    对每场考试,首先在第1行输出不低于分数线的考生人数n,随后n行按分数从高到低输出上线考生的考号与分数,其间用1空格分隔。若有多名考生分数相同,则按他们考号的升序输出。

样例输入:
4 5 2510 10 12 13 15CS004 3 5 1 3CS003 5 2 4 1 3 5CS002 2 1 2CS001 3 2 3 51 2 4010 30CS001 1 22 3 2010 10 10CS000000000000000001 0CS000000000000000002 2 1 20
样例输出:
3CS003 60CS001 37CS004 3701CS000000000000000002 20
来源:
 
Code:
#include 
#include
#include
#include
using namespace std; struct Student{ string ID; int solveNum; vector
problemID; int score;}; int CalculateScore(vector
&problemID,vector
&problemScore){ int answer=0; for(unsigned int i=0;i
b.score; return a.ID<=b.ID;} int main(){ Student arr[1010]; int N,M,G; vector
problemScore; while(cin>>N){ if(N==0) break; problemScore.clear(); for(int i=0;i
>M>>G; for(int i=0;i
>tmpScore; problemScore.push_back(tmpScore); } for(int i=0;i
>arr[i].ID; cin>>arr[i].solveNum; for(int j=0;j
>tmpID; arr[i].problemID.push_back(tmpID); } arr[i].score=CalculateScore(arr[i].problemID,problemScore); } sort(arr,arr+N,cmp); int studentCount=0; for(int i=0;i
=G) ++studentCount; cout<
<

 

转载于:https://www.cnblogs.com/Murcielago/p/4209045.html

你可能感兴趣的文章
Proxy模式
查看>>
读书多些会怎样
查看>>
浏览器好用的技术
查看>>
HDU 2188------巴什博弈
查看>>
tp5任务队列使用supervisor常驻进程
查看>>
Xmind?
查看>>
spring+quartz 实现定时任务三
查看>>
day2-三级菜单
查看>>
linux下升级4.5.1版本gcc
查看>>
Beanutils
查看>>
FastJson
查看>>
excel4j
查看>>
Thread
查看>>
char * 与char []探究理解
查看>>
QT窗体显示在屏幕中间位置
查看>>
emmet使用技巧
查看>>
RPC-Thrift(二)
查看>>
MSSQL for Linux 安装指南
查看>>
【Golang 接口自动化08】使用标准库httptest完成HTTP请求的Mock测试
查看>>
前端必读:浏览器内部工作原理
查看>>