PAT 1083 List Grades
#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的更多相关文章
- PAT 1083 List Grades[简单]
1083 List Grades (25 分) Given a list of N student records with name, ID and grade. You are supposed ...
- PAT 甲级 1083 List Grades (25 分)
1083 List Grades (25 分) Given a list of N student records with name, ID and grade. You are supposed ...
- PAT 甲级 1083 List Grades
https://pintia.cn/problem-sets/994805342720868352/problems/994805383929905152 Given a list of N stud ...
- 【PAT甲级】1083 List Grades (25 分)
题意: 输入一个正整数N(<=101),接着输入N个学生的姓名,id和成绩.接着输入两个正整数X,Y(0<=X,Y<=100),逆序输出成绩在x,y之间的学生的姓名和id. tric ...
- PAT (Advanced Level) 1083. List Grades (25)
简单排序. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...
- 1083. List Grades (25)
the problem is from PAT,which website is http://pat.zju.edu.cn/contests/pat-a-practise/1083 and the ...
- PAT 1083 是否存在相等的差(20)(代码+思路)
1083 是否存在相等的差(20 分) 给定 N 张卡片,正面分别写上 1.2.--.N,然后全部翻面,洗牌,在背面分别写上 1.2.--.N.将每张牌的正反两面数字相减(大减小),得到 N 个非负差 ...
- 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 ...
- 1083 List Grades
Given a list of N student records with name, ID and grade. You are supposed to sort the records with ...
随机推荐
- SHELL编程之条件测试
条件测试 (一)概念:对特定的条件进行判断,以决定如何执行操作,当条件成立时,测试语句的返回值为0,否则为其他数值,意思就是如果 echo $? 的值是0,那么条件成立.条件测试的分类:文件测试.整数 ...
- Unity---动画系统学习(3)---使用状态机来实现走、跑、转弯等的动画切换
1. 初始设置 用动画学习笔记(2)中方法,把动画全都切割好. 拖进状态机并设置箭头.并设置具体箭头触发的事件. 在状态机左侧中添加参数,Float和Int类型参数只能从-1~1之间变化 Float: ...
- 并查集简述 (HDU-1213-How Many Tables)
并查集主要解决集合的有关运算,主要操作是查找操作和并操作. 1.集合的储存方式. 为便于查找,集合通常以树结构储存,每个元素分 数据域和指针域,可以用链式储存,也可以用结构数组储存,用根节点来表示一个 ...
- SDUT OJ 数据结构实验之串三:KMP应用
数据结构实验之串三:KMP应用 Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Discuss Problem Descrip ...
- SDUT OJ 顺序表应用6:有序顺序表查询
顺序表应用6:有序顺序表查询 Time Limit: 1000 ms Memory Limit: 4096 KiB Submit Statistic Discuss Problem Descripti ...
- VS2010 由于缺少调试目标"xx.exe"
有两种可能会造成这种现像.A.配制属性出了问题. 一种方法:右击“解决方案”->“属性”,在弹出的“属性页”框中,选择左边的“配置属性”,在右边,将应用程序的生成那个框框勾上,二可能是这里的属性 ...
- 深入解析Close()和Dispose()的区别
很多人都认为Close()方法内部会调用Dispose()方法,所以并没有本质的区别!实际上这个看法不是很准确,对有 些类来说,的确Close()和Dispose()没有本质区别,但是对有些类来说并非 ...
- Java8如何用
2014年发布的Java8,现在应该是业界使用最普遍的Java版本,可很多Java开发人员并没有充分发挥这4年前发布的版本的优点, 本文就是带着“学以致用”的目的去了解Java8,挖掘编码中可提高效率 ...
- docker 解决容器时间与主机时间不一致的问题
环境: 1.阿里云ecs服务器 2.docker 3.docker镜像 centos7.4.1708 方法一: 查看主机时间: [root@iZbp1625jeg61bc2zzfcotZ docker ...
- python3 模块安装列表
pip install scrapy pip install twisted pip install BeautifulSoup4 pip install lxml pip install Pillo ...