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 ...
随机推荐
- LAMP课程(3)
LAMP课程(3) 一.bash的使用 1.1.输出重定向 >:覆盖输出(写入内容) 具体实例1:将内容写入到文件中 >>:追加输出 具体实例2: 1.2 && ...
- JavaBean的概念
Java的一个特性,数据与行为相分离.数据就是成员变量,行为就是setter和getter方法 JavaBean是Java中开发的可以跨平台的重要组件,在JSP中常用来封装业务逻辑和数据库操作.Jav ...
- 190320运算符&数据类型
一.运算符 1.算术运算符 + 加 - 减 * 乘 / 除 ** 平方 // 整除 % 取余 2.比较运算符 == 等于 > 大于 < 小于 <= 小于等于 >= 大于等于 ! ...
- Vue-think脚手架
准备重构的项目,原来的后台是thinkPHP写的,刚刚摸VUE,不知道里面数据调用原理,想先安装vuethink学习一下. 结果安装半天,npm run dev的时候报错,尝试了很多方法,各种重装,看 ...
- C#中实现https的双向认证
1. 把浏览器中的证书导出为cer文件. 2. 代码如下: using System; using System.Net; using System.IO; using System.Secur ...
- 在 Domoticz 中添加插座开关
前言 继上一篇的折腾,将 WiFi 插座刷为 ESPEasy,这次介绍一下在 Domoticz 中启用该插座的方法 步骤 在 Domoticz 控制台,设置 → 硬件中添加 Dummy,名称为&quo ...
- Python web前端 03 CSS属性
Python web前端 03 CSS属性 一.文字.文本属性 1.文字属性 font-family #字体类型浏览器默认的字体是微软雅黑,字体中有多个字体的时候,如果前面的字体没有就使用后面的字体 ...
- cenos安装erlang
https://blog.zfanw.com/install-erlang-on-centos/
- 获取HTML代码用 像阿里巴巴
public string GetHtml(string url) { string html = String .Empty; ...
- 在linux服务器上配置anaconda和Tensorflow,并运行
1. 查看服务器上的Python安装路径: whereis python 2. 查看安装的Python版本号: python 3. 安装Anaconda: 1)下载 Anaconda2-4.0.0-L ...