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& ...
随机推荐
- ubuntu 软件管理
软件安装管理 安装软件 sudo apt-get install **** 检索软件 sudo apt-cache search **** 更新源 sudo apt-get update **** ...
- 使用shell脚本自定义实现选择登录ssh
在系统bin目录中建立两个脚本分别是pssh tssh pssh #!/usr/bin/expect -f set ip [lindex ] set port [lindex ] set passwo ...
- Inno Setup入门(十六)——Inno Setup类参考(2)
分类: Install Setup 2013-02-02 11:28 815人阅读 评论(0) 收藏 举报 这里将接着在前面的基础上介绍如何在自定义页面上添加按钮.按钮属于Tbutton类,该类继承自 ...
- //获取url中"?"符后的字串
//获取url中"?"符后的字串 function getParamByUrl(url) { var theRequest = new Object(); var in ...
- 最小点集覆盖/HDU2119
题目连接 先试一下题/?/ 最小点集覆盖=最大匹配 /*根据i.j建图,跑一边最大匹配 */ #include<cstdio> #include<cstring> using ...
- php实现json
<?PHP function __json_encode( $data ) { if( is_array($data) || is_object($data) ) { $islist = is_ ...
- Android中自定义veiw使用Java中的回调方法
//------------------MainActivity----中---------------------------------- import android.os.Bundle;imp ...
- building system busy, pls wait !!
编译ca是可能会报这个错误,是189服务器上的/home/pub-work/.android_build_lock这个文件的问题,删除即可.
- lucene中Field.Index,Field.Store的一些设置
lucene在doc.add(new Field("content",curArt.getContent(),Field.Store.NO,Field.Index.TOKENIZE ...
- 转:Loadrunner——Block(块)技术
在使用LoadRunner时经常遇到这样一个问题,如果对不同的事务进行不同次数的循环该怎么处理?默认情况下LR对所有的事务都是统一执行的,即虽然有多个事务,但它们被执行的循环次数都是一样的,那么LR如 ...