#include <cstdio>
#include <cstdlib> using namespace std; class Stu {
public:
char name[];
char id[];
}; int main() {
int N = ;
// because all the grades are distinct & grade in range of [0, 100]
// use simplified bucket sort here
Stu* stu[] = {};
int grade;
scanf("%d", &N);
for (int i=; i<N; i++) {
Stu* tmp = new Stu();
scanf("%s%s%d", tmp->name, tmp->id, &grade);
stu[grade] = tmp;
} int lo, hi;
scanf("%d%d", &lo, &hi);
if (lo > hi) {
int tmp = lo;
lo = hi;
hi = tmp;
}
bool has = false;
for (int i=hi; i>=lo; i--) {
if (stu[i] == NULL) continue;
has = true;
printf("%s %s\n", stu[i]->name, stu[i]->id);
}
if (!has) {
printf("NONE");
}
return ;
}

完成每日任务,睡觉了可以!

PAT 1083 List Grades的更多相关文章

  1. PAT 1083 List Grades[简单]

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

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

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

  3. PAT 甲级 1083 List Grades

    https://pintia.cn/problem-sets/994805342720868352/problems/994805383929905152 Given a list of N stud ...

  4. 【PAT甲级】1083 List Grades (25 分)

    题意: 输入一个正整数N(<=101),接着输入N个学生的姓名,id和成绩.接着输入两个正整数X,Y(0<=X,Y<=100),逆序输出成绩在x,y之间的学生的姓名和id. tric ...

  5. PAT (Advanced Level) 1083. List Grades (25)

    简单排序. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...

  6. 1083. List Grades (25)

    the problem is from PAT,which website is http://pat.zju.edu.cn/contests/pat-a-practise/1083 and the ...

  7. PAT 1083 是否存在相等的差(20)(代码+思路)

    1083 是否存在相等的差(20 分) 给定 N 张卡片,正面分别写上 1.2.--.N,然后全部翻面,洗牌,在背面分别写上 1.2.--.N.将每张牌的正反两面数字相减(大减小),得到 N 个非负差 ...

  8. PTA(Advanced Level)1083.List Grades

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

  9. 1083 List Grades

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

随机推荐

  1. BZOJ4650/UOJ219 [Noi2016]优秀的拆分

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...

  2. linux下 zip解压 tar解压 gz解压 bz2等各种解压文件命令

    .tar 解包:tar xvf FileName.tar 打包:tar cvf FileName.tar DirName (注:tar是打包,不是压缩!) ——————————————— .gz 解压 ...

  3. 2. C语言文件操作经典习题

    1. 统计英文文本文件中,有多少个大写字母.小写字母.数字.空格.换行以及其他字符. #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> ...

  4. zabbix 3.0 快速安装文档

    下载地址:http://www.zabbix.com/download.php 官方文档:https://www.zabbix.com/documentation/3.0/manual/install ...

  5. 在Discuz X 中增加一个单独的页面

    如果在DZ中增加一个新的页面,并且取得DZ中相关的用户等乱七八糟的属性,在旧的版本中只要引用一个 -. comm.php 文件就可以,但是在 X 版本以后好像就没.还好,X版本中还是有办法解决的,使用 ...

  6. PHP编程入门与应用

    基础语法.流程控制语句.数组的应用.字符串的应用————3天 PHP函数————3天 面向对象————3天 文件处理————2天 获取页面数据.会话处理————3天 数据库————5天 XML和JSO ...

  7. 将多个单元格内容连接到一个单元格中(EXCEL)

    连接符号:& 如下图,我们要将表格中每名员工的姓名.入职时间以及年龄放入到同一个单元格中,形成以“-”连接的形式. 这时我们要用到Excel中的连接符“&”,也就是在按下Shift+数 ...

  8. python之常用的数据类型

    1. 变量的定义以及声明 在学习变量之前,咱们需要知道变量的命名规则: ① 变量必须由数字字母下划线构成,如a_1 ② 变量名不能以数字开头,如1a ③ 需要遵循驼峰命名法 给变量赋值通常采用“=”, ...

  9. C++_函数2-内联函数

    内联函数的目的是为了提高程序运行速度所做的一项改进. 常规函数与内联函数的区别不在于编写方式,而在于C++编译器如何将它们组合到程序中. 编译过程的最终产品是:可执行程序,由一组机器语言指令组成.运行 ...

  10. Oracle9i之xmltype应用(1)

    oracle从9i开始支持一种新的数据类型-- xmltype,用于存储和管理xml数据,并提供了很多的functions,用来直接读取xml文档和管理节点.下面将介绍xmltype的一些基本使用. ...