1083. List Grades (25)
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)的更多相关文章
- 【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)-简单的排序
给定区间[L,R],给出在这区间之内的学生,并且按照他们的成绩非升序的顺序输出. #include <iostream> #include <cstdio> #include ...
- pat1083. List Grades (25)
1083. List Grades (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Given a l ...
- 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[简单]
1083 List Grades (25 分) Given a list of N student records with name, ID and grade. You are supposed ...
- 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 ...
- 1083 List Grades
Given a list of N student records with name, ID and grade. You are supposed to sort the records with ...
- PAT 甲级 1083 List Grades
https://pintia.cn/problem-sets/994805342720868352/problems/994805383929905152 Given a list of N stud ...
随机推荐
- 精雕细琢 35 套精美的 PSD 图标素材
设计师总是有独特的创意和精雕细琢的精湛技术,让我们值得去欣赏和借鉴,如梦想天空所表达的:非常感谢那些很有才华的设计师分享它们的劳动成果,让更多的人可以使用他们的创意设计.今天,本文与大家分享35套精美 ...
- 【九度OJ】题目1434贪心算法
题目 本题的贪心算法策略需要深入思考一下 看到题目,最初没有理解题目的要求:看尽量多的完整的节目.尽量多是指数量多,自己理解成观看的时间最长.这样想其实简化了这道题. 正确理解题意后,首先想到的想法是 ...
- 引擎 innodb 与 myisam 的区别
使用innodb引擎 , 查询800万数据的统计: 将innodb 引擎 改成 MyISAM引擎: alter table test_count engine = MyISAM;
- redis高级实用特性
1. 安全性 2. 主从复制 3. 事务处理 4. 持久化机制 5. 发布订阅消息 : 可以做一个消息系统 6. 虚拟内存的使用 一 . 安全性 设置客户端连接后进行任何其他指定前需要使用的密码 . ...
- 第二百九十四天 how can I 坚持
这是怎么了,好难受,晚上都没吃饭,全身都疼.该咋办. 其实,真的是身体最重要. 洗洗睡了.好难受.
- 【转】 Nginx系列(一)--nginx是什么?
原博文出于:http://blog.csdn.net/liutengteng130/article/details/46700939 感谢! 一.介绍 Nginx是一个高性能的HTTP和反向代理服务 ...
- 第八章、Linux 磁盘与文件系统管理
认识 EXT2 文件系统 Linux最传统的磁盘文件系统(filesystem)使用的是EXT2这个啦!所以要了解文件系统就得要由认识EXT2开始! 而文件系统是创建在硬盘上面的,因此我们得了解硬盘的 ...
- BestCoder Round #73 (div.2)(hdu 5630)
Rikka with Chess Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) ...
- [iOS基础控件 - 6.9] 聊天界面Demo
A.需求 做出一个类似于QQ.微信的聊天界面 1.每个cell包含发送时间.发送人(头像).发送信息 2.使用对方头像放在左边,我方头像在右边 3.对方信息使用白色背景对话框,我方信息使用蓝色背景对话 ...
- java中MessageDigest加密工具类
import java.security.MessageDigest; public class EncryptionKit { public static String md5Encrypt(Str ...