博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
1083. List Grades (25)
阅读量:4624 次
发布时间:2019-06-09

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

1083. List Grades (25)

Given a list of N student records with name, ID and grade. You are supposed to sort the records with respect to the grade in non-increasing order, and output those student records of which the grades are in a given interval.

Input Specification:

Each input file contains one test case. Each case is given in the following format:

Nname[1] ID[1] grade[1]name[2] ID[2] grade[2]... ...name[N] ID[N] grade[N]grade1 grade2

where name[i] and ID[i] are strings of no more than 10 characters with no space, grade[i] is an integer in [0, 100], grade1 and grade2 are the boundaries of the grade's interval. It is guaranteed that all the grades are distinct.

Output Specification:

For each test case you should output the student records of which the grades are in the given interval [grade1, grade2] and are in non-increasing order. Each student record occupies a line with the student's name and ID, separated by one space. If there is no student's grade in that interval, output "NONE" instead.

Sample Input 1:

4Tom CS000001 59Joe Math990112 89Mike CS991301 100Mary EE990830 9560 100

Sample Output 1:

Mike CS991301Mary EE990830Joe Math990112

Sample Input 2:

2Jean AA980920 60Ann CS01 8090 95

Sample Output 2:

NONE
#include 
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;struct student{ string name; string id; int score;}stu[100050];bool cmp(student a,student b){ return a.score>b.score;}int main(){ int n; cin>>n; for(int i=0;i
>stu[i].name>>stu[i].id>>stu[i].score; } int left,right; int cnt_output=0; cin>>left>>right; vector
output; sort(stu,stu+n,cmp); for(int i=0;i
=left&&stu[i].score<=right) { cnt_output++; output.push_back(i); } } if(cnt_output==0) cout<<"NONE"; else { // cout<
<

 

转载于:https://www.cnblogs.com/brightz2017/p/6606778.html

你可能感兴趣的文章
软件测试
查看>>
Js 提交 form 表单
查看>>
Response.Status http协议状态代码
查看>>
BZOJ4925 城市规划
查看>>
Bootstrap 辅助类
查看>>
TCP、UDP、HTTP、SOCKET之间的区别
查看>>
根据Buffer中的图片数据进行图片呈现的方法.
查看>>
用Python编写WordCount程序任务
查看>>
AC日记——传纸条 洛谷 P1006
查看>>
Android Gradle 多Module单独编译一个Module
查看>>
React显示文件夹中SVG
查看>>
编码规范小结
查看>>
695. Max Area of Island
查看>>
(转)Cortex-M3 (NXP LPC1788)之SDRAM操作
查看>>
201671010437 王小倩+词频统计软件项目报告
查看>>
python中的变量,字符串,用户交互,if语句
查看>>
django的模板文件需要为utf-8无bom格式
查看>>
linux 下查看文件修改时间,访问时间,状态改变时间
查看>>
Math类函数总结
查看>>
701 C. They Are Everywhere
查看>>