the problem is from PAT,which website is http://pat.zju.edu.cn/contests/pat-a-practise/1083

and the source code is as followed.

/*
firstly: sort the array using the algorithm "sort"
secondly: traverse all the possible answer and find the most suitable one.
*/
#include<iostream>
#include<vector>
#include<string>
#include<algorithm> using namespace std; struct record
{
string name;
string id;
int grade;
}; bool cmp(record x,record y)
{
return x.grade > y.grade;
} int main()
{
int n;
record temp;
vector<record> v;
cin>>n;
while (n--)
{
cin>>temp.name>>temp.id>>temp.grade;
v.push_back(temp);
}
int low,high;
cin>>low>>high; sort(v.begin(),v.end(),cmp);
int count = ;
for (int i = ; i < v.size(); i++)
{ if (v[i].grade>=low && v[i].grade <= high)
{
cout<<v[i].name<<" "<<v[i].id<<endl;
count += ;
}
}
if (count == )
{
cout<<"NONE"<<endl;
} }

this one is easy.and it doesn’t need to talk too much. If there are something to be noticed ,

maybe i think we should notice the boundery.

1083. List Grades (25)的更多相关文章

  1. 【PAT甲级】1083 List Grades (25 分)

    题意: 输入一个正整数N(<=101),接着输入N个学生的姓名,id和成绩.接着输入两个正整数X,Y(0<=X,Y<=100),逆序输出成绩在x,y之间的学生的姓名和id. tric ...

  2. PAT (Advanced Level) 1083. List Grades (25)

    简单排序. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #i ...

  3. 1083. List Grades (25)-简单的排序

    给定区间[L,R],给出在这区间之内的学生,并且按照他们的成绩非升序的顺序输出. #include <iostream> #include <cstdio> #include ...

  4. pat1083. List Grades (25)

    1083. List Grades (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a l ...

  5. PAT 甲级 1083 List Grades (25 分)

    1083 List Grades (25 分) Given a list of N student records with name, ID and grade. You are supposed ...

  6. PAT 1083 List Grades[简单]

    1083 List Grades (25 分) Given a list of N student records with name, ID and grade. You are supposed ...

  7. A1083 List Grades (25)(25 分)

    A1083 List Grades (25)(25 分) Given a list of N student records with name, ID and grade. You are supp ...

  8. 1083 List Grades

    Given a list of N student records with name, ID and grade. You are supposed to sort the records with ...

  9. PAT 甲级 1083 List Grades

    https://pintia.cn/problem-sets/994805342720868352/problems/994805383929905152 Given a list of N stud ...

随机推荐

  1. Socket异步发送的同步控制

    在网络通信中,我们使用Socket异步发送数据,但在客户端,往往是需要等待服务器的返回结果后(握手过程)再往下执行,这就涉及到同步控制了,在多次的实现中,使用AutoResetEvent,实现不,即有 ...

  2. 利用flashback query 恢复表数据

    flashback query可以查询过去某个时间点对象的状态,从而可以利用此来进行恢复数据 1 准备测试数据 用普通用户创建一个表,表中插入部分数据: SQL> show user USER ...

  3. MFC特定函数的应用20160720(SystemParametersInfo,GetWindowRect,WriteProfileString,GetSystemMetrics)

    1.SystemParametersInfo函数可以获取和设置数量众多的windows系统参数 MFC中可以用 SystemParametersInfo(……) 函数来获取和设置系统信息,如下面例子所 ...

  4. java 最佳且开源的反编译工具

    1.jad:2.jode 很多gui的反编译工具(decafe,DJ,cavaJ)差不多都是基于jad和jode的.

  5. AVD设置屏幕大小

    相关资料: 1.http://jingyan.baidu.com/article/fedf0737775d2835ac897700.html

  6. HDU 5806 NanoApe Loves Sequence Ⅱ (模拟)

    NanoApe Loves Sequence Ⅱ 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5806 Description NanoApe, t ...

  7. ios页面传值的几种方法

    1.属性2.方法3.代理方法4.SharedApplication5.NSUserdefault6.通过一个单例的class来传递 属性这种方法传值挺方便的,只需要拿到它的指针,如果重新声明一个指针, ...

  8. HDU 5835 Danganronpa (水题)

    题意:给定 n 个礼物有数量,一种是特殊的,一种是不特殊的,要分给一些人,每人一个特殊的一个不特殊,但是不特殊的不能相邻的,问最多能分给多少人. 析:是一个比较简单的题目,我们只要求差值就好,先算第一 ...

  9. Junit使用教程(二)

    二.核心——断言 断言是编写测试用例的核心实现方式,即期望值是多少,测试的结果是多少,以此来判断测试是否通过. 1. 断言核心方法 assertArrayEquals(expecteds, actua ...

  10. 【Java】Socket+多线程实现控制台聊天室

    转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/5827212.html 聊天室程序的结构图: 架构解释: Server服务器相当于一个中转站,Client客户端 ...