PAT (Advanced Level) 1083. List Grades (25)
简单排序。
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std; struct X
{
string s;
string c;
int g;
}p[];
int n; bool cmp(const X&a,const X&b)
{
return a.g>b.g;
} int main()
{
scanf("%d",&n);
for(int i=;i<=n;i++)
cin>>p[i].s>>p[i].c>>p[i].g;
sort(p+,p++n,cmp); int flag=;
int L,U; scanf("%d%d",&L,&U);
for(int i=;i<=n;i++)
{
if(p[i].g>=L&&p[i].g<=U)
{
cout<<p[i].s<<" "<<p[i].c<<endl;
flag=;
}
}
if(flag==) printf("NONE\n");
return ;
}
PAT (Advanced Level) 1083. List Grades (25)的更多相关文章
- 【PAT甲级】1083 List Grades (25 分)
题意: 输入一个正整数N(<=101),接着输入N个学生的姓名,id和成绩.接着输入两个正整数X,Y(0<=X,Y<=100),逆序输出成绩在x,y之间的学生的姓名和id. tric ...
- 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 ...
- PAT (Advanced Level) 1114. Family Property (25)
简单DFS. #include<cstdio> #include<cstring> #include<cmath> #include<vector> # ...
- PAT (Advanced Level) 1109. Group Photo (25)
简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...
- PAT (Advanced Level) 1105. Spiral Matrix (25)
简单模拟. #include<cstdio> #include<cstring> #include<cmath> #include<map> #incl ...
- PAT (Advanced Level) 1101. Quick Sort (25)
树状数组+离散化 #include<cstdio> #include<cstring> #include<cmath> #include<map> #i ...
- PAT (Advanced Level) 1071. Speech Patterns (25)
简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...
- PAT (Advanced Level) 1063. Set Similarity (25)
读入之后先排序. 询问的时候可以o(m)效率得到答案. #include<cstdio> #include<cstring> #include<cmath> #in ...
- PAT (Advanced Level) 1059. Prime Factors (25)
素因子分解. #include<iostream> #include<cstring> #include<cmath> #include<algorithm& ...
随机推荐
- 详细,Qt Creator快捷键大全,附快捷键配置方法
一.快捷键配置方法: 进入“工具->选项->环境->键盘”即可配置快捷键. 二.常用默认快捷键: 编号 快捷键 功能 1 Esc 切换到代码编辑状态 2 F1 查看帮助(选中某一类或 ...
- shell 变量说明
变量说明 $$Shell本身的PID(ProcessID)$!Shell最后运行的后台Process的PID$?最后运行的命令的结束代码(返回值)$-使用Set命令设定的Flag一览$*所有参数列表. ...
- make module失败的原因cc1: error: unrecognized command line option “-m64
cc1: error: unrecognized command line option "-m64"cc1: error: unrecognized command line o ...
- Docker 简介及安装
Docker简介: 什么是Docker?将应用程序自动部署到容器 go语言开源引擎 Github地址:https://github.com/docker/docker 2013年初 dotCloud ...
- 【转】Xshell 十个技巧
原文:http://www.cnblogs.com/wanhl/archive/2012/10/17/2727607.html 一.帐号密码保存.可以保存多个vps登陆信息,免去每次输入的烦恼. 二. ...
- ignite服务中的bean注入为空
在写ignite服务的时候,通常服务配置在启动文件中: <bean class="org.apache.ignite.services.ServiceConfiguration&quo ...
- stl function扩展(一)
#ifndef _FUNCTION_LIB_H_ #define _FUNCTION_LIB_H_ #include <functional> namespace function_lib ...
- 给Notepad++ 加带图标右键菜单
给Notepad++ 加带图标右键菜单 方式一: 拷贝以下代码建立一个reg文件,替换相关路径,保存,双击运行加入注册表 Windows Registry Editor Version 5.00 [H ...
- svn 设置文件可执行权限
本地文件在commit到仓库之前若没有chmod +x 权限的话,那在svn仓库里的文件将会保持当前无可执行属性状态. 即使在本地chmod +x filename 之后,再提交到仓库也是没有用的.c ...
- java 环境的配置
JAVA_HOMEC:\Program Files\Java\jdk1.6.0_02 PATHC:\Program Files\Java\jdk1.6.0_02\bin CLASSPATH.;%JAV ...