1083. List Grades (25)-简单的排序
给定区间[L,R],给出在这区间之内的学生,并且按照他们的成绩非升序的顺序输出。
#include <iostream>
#include <cstdio>
#include <string.h>
#include <algorithm>
using namespace std;
const int maxn=; struct Stu{
char name[];
char id[];
int grade;
bool operator<(const Stu tmp)const{
return grade>tmp.grade;
}
}stu[maxn];
int main()
{
int n;
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);
int left,right;
scanf("%d %d",&left,&right);
int cnt=;
for(int i=;i<n;i++){
if(left<=stu[i].grade && stu[i].grade<=right){
printf("%s %s\n",stu[i].name,stu[i].id);
cnt++;
}
}
if(cnt==){
printf("NONE\n");
}
return ;
}
1083. List Grades (25)-简单的排序的更多相关文章
- 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 List Grades (25 分)
题意: 输入一个正整数N(<=101),接着输入N个学生的姓名,id和成绩.接着输入两个正整数X,Y(0<=X,Y<=100),逆序输出成绩在x,y之间的学生的姓名和id. tric ...
- pat1083. List Grades (25)
1083. List Grades (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a l ...
- 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 A1137 Final Grading (25 分)——排序
For a student taking the online course "Data Structures" on China University MOOC (http:// ...
- PAT A1028 List Sorting (25 分)——排序,字符串输出用printf
Excel can sort records according to any column. Now you are supposed to imitate this function. Input ...
- 程序员必知的8大排序(二)-------简单选择排序,堆排序(java实现)
程序员必知的8大排序(一)-------直接插入排序,希尔排序(java实现) 程序员必知的8大排序(二)-------简单选择排序,堆排序(java实现) 程序员必知的8大排序(三)-------冒 ...
随机推荐
- excle函数
1.time函数 说明: https://support.office.com/zh-cn/article/time-%E5%87%BD%E6%95%B0-9a5aff99-8f7d-4611-845 ...
- jquery1.9 下检测浏览器类型和版本的方法
Jquery1.9版本中$.browser已被剔除: 判断浏览器类型: 复制代码 代码如下: $.browser.mozilla = /firefox/.test(navigator.userAgen ...
- BZOJ5016:[SNOI2017]一个简单的询问(莫队)
Description 给你一个长度为N的序列ai,1≤i≤N和q组询问,每组询问读入l1,r1,l2,r2,需输出 get(l,r,x)表示计算区间[l,r]中,数字x出现了多少次. Input 第 ...
- myEtherWallet在线钱包的使用
https://www.myetherwallet.com/#generate-wallet myEtherWallet是一款在线钱包,当你不想安装类似metamask这样的插件时,可以选择使用它 1 ...
- Python2.7-string模块
string模块 1.模块内定义的常数 字母(ascii_letters.letters),数字(digits.hexdigits.octdigits),空格(whitespace),大小写(asci ...
- JAVA框架Struts2--配置讲解
一.配置讲解: <struts> <package name="oop" namespace="/" extends="struts ...
- 服务器端数据合法性验证:签名sign和口令token原理
有时候,你也许会想: 我写的接口,那别人要是知道url,并且知道其需要的数据结构和逻辑,那不是都可以访问了? 甚至是,客户点传递过来的数据,是不是被恶意修改了? 这时,我们可能需要“验证”一下.比如: ...
- EXCEL2007出错了无法使用文档中的ActiveX 控件
EXCEL2007出错了无法使用文档中的ActiveX 控件虽说是很久之前的问题,但是正确的解决方法和原因如下!原因:系统update之后出现的问题解决方法:删除C:\Users\[username] ...
- 数据结构与算法 基于c语言篇
学习数据结构与算法走向深蓝之路 第一章:数据结构与算法概念型 数据结构:数据之间的相互关系,即是数据的组织形式. 基本组成:{ 数据:信息的载体 数据元素:数据基本单位: } 其结构形式有四种: 1, ...
- Python3入门(一)——概述与环境安装
一.概述 1.python是什么 Python 是一个高层次的结合了解释性.编译性.互动性和面向对象的脚本语言. Python 是一种解释型语言: 这意味着开发过程中没有了编译这个环节.类似于PHP和 ...