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:

N
name[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:

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

Sample Output 1:

Mike CS991301
Mary EE990830
Joe Math990112

Sample Input 2:

2
Jean AA980920 60
Ann CS01 80
90 95

Sample Output 2:

NONE
 #include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
typedef struct{
char name[];
char id[];
int grade;
}info;
bool cmp(info a, info b){
return a.grade > b.grade;
}
info stu[];
int main(){
int N, high, low, cnt = ;
scanf("%d", &N);
for(int i = ; i < N; i++)
scanf("%s %s %d", stu[i].name, stu[i].id, &(stu[i].grade));
sort(stu, stu + N, cmp);
scanf("%d%d", &low, &high);
for(int i = ; i < N; i++){
if(stu[i].grade >= low && stu[i].grade <= high){
printf("%s %s\n", stu[i].name, stu[i].id);
cnt++;
}
}
if(cnt == )
printf("NONE");
cin >> N;
return ;
}

A1083. List Grades的更多相关文章

  1. A1083 List Grades (25)(25 分)

    A1083 List Grades (25)(25 分) Given a list of N student records with name, ID and grade. You are supp ...

  2. A1083 List Grades (25 分)

    Given a list of N student records with name, ID and grade. You are supposed to sort the records with ...

  3. PAT甲级——A1083 List Grades

    Given a list of N student records with name, ID and grade. You are supposed to sort the records with ...

  4. PAT_A1083#List Grades

    Source: PAT A1083 List Grades (25 分) Description: Given a list of N student records with name, ID an ...

  5. PAT甲级题解分类byZlc

    专题一  字符串处理 A1001 Format(20) #include<cstdio> int main () { ]; int a,b,sum; scanf ("%d %d& ...

  6. PAT1083:List Grades

    1083. List Grades (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a l ...

  7. PAT 甲级 1083 List Grades (25 分)

    1083 List Grades (25 分) Given a list of N student records with name, ID and grade. You are supposed ...

  8. Taking water into exams could boost grades 考试带瓶水可以提高成绩?

    Takeing a bottle of water into the exam hall could help students boost their grades, researchers cla ...

  9. PAT 1083 List Grades[简单]

    1083 List Grades (25 分) Given a list of N student records with name, ID and grade. You are supposed ...

随机推荐

  1. ASP.NETZERO 开发者指南-目录篇

    前面的话 此教程适用于 ASP.NET MVC 5.x & Angularjs 1.x  的ABP框架(收费需要授权) 所以有能力的朋友还是希望你们多多支持 土牛.购买链接:https://w ...

  2. wordcount程序

    wordcount程序算是相比于前几次作业来说比较难得一个作业了.进行了一次真的自己编写程序.WC程序实现了对txt文件中的数据的计数,算出程序中有多少单词.字符数以及行数.这次的程序编程是采用的C语 ...

  3. 转发:C#加密方法汇总

    转自:C#加密方法汇总 方法一: //须添加对System.Web的引用 using System.Web.Security; ... /// <summary> /// SHA1加密字符 ...

  4. [ERROR] Failed to execute goal org.codehaus.mojo:gwt-maven-plugin:2.5.0-rc1:compile (default) on project zeus-web: Command 解决

    在编译maven项目,打包maven packeage -Dmaven.test.skip=TRUE时,报错“[ERROR] Failed to execute goal org.codehaus.m ...

  5. java面对对象(六)--内部类、匿名内部类

    内部类 可以在一个类的内部定义另一个类这种类成为内部类或嵌套类,比如: class Outer{ … class Inner{ …. } } class Outer1{} // 这个Inner1不是O ...

  6. BUAA软工个人作业Week3-案例分析

    一. 调研评测 评测项目:为了联系移动和PC版,我同时下载了必应词典的Android版本和UWP版本,选择UWP的原因是想看看微软推广的UWP在微软自己的应用上的效果.当然主要是对安卓的测评(UWP用 ...

  7. TestNG—学习笔记2

    关于TestNG,也是一边学一边总结,对于TestNG和Junit的比较其实也没有什么意义,都是一种测试框架,都是为了应用而生的东西,没有必要说谁好谁不好了.用的熟练用的好就是真的好啊. 下面简单的总 ...

  8. Android控件第5类——ViewAnimator

    1.ViewAnimator,继承自FrameLayout ViewAnimator是一个基类,它继承自FrameLayout.它的子类有ViewSwitcher和ViewFlipper:ViewSw ...

  9. Angular 行内式依赖注入

    var app = angular.module('myApp', ['ng']); //创建一个自定义服务app.factory('$Debug', function () { return { d ...

  10. loadrunner基础学习笔记七-面向目标场景

    部署应用程序之前,要执行验收测试以确保系统能够承担预期的实际工作量. 可以为想要生成的每秒点击次数,每秒事务数或事务响应时间设置目标 loadrunner将使用面向目标的场景自动生成所需的目标,当应用 ...