题意:

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

trick:

测试点3格式错误因为输出的所有学生姓名和id后面都要换行,大概如果PAT没说不要输出多余的换行的话,就全都加个换行,说了就不加。。。。。

AAAAAccepted code:

 1 #define HAVE_STRUCT_TIMESPEC
2 #include<bits/stdc++.h>
3 using namespace std;
4 typedef struct student{
5 string name,id;
6 int grade;
7 };
8 student a[107];
9 bool cmp(student a,student b){
10 return a.grade>b.grade;
11 }
12 int main(){
13 ios::sync_with_stdio(false);
14 cin.tie(NULL);
15 cout.tie(NULL);
16 int n;
17 cin>>n;
18 for(int i=1;i<=n;++i)
19 cin>>a[i].name>>a[i].id>>a[i].grade;
20 int x,y;
21 cin>>x>>y;
22 if(x>y)
23 swap(x,y);
24 sort(a+1,a+1+n,cmp);
25 int flag=0;
26 for(int i=1;i<=n;++i)
27 if(a[i].grade>=x&&a[i].grade<=y){
28 cout<<a[i].name<<" "<<a[i].id<<"\n";
29 flag=1;
30 }
31 if(!flag)
32 cout<<"NONE"<<endl;
33 return 0;
34 }

【PAT甲级】1083 List Grades (25 分)的更多相关文章

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

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

  2. PAT 甲级 1028 List Sorting (25 分)(排序,简单题)

    1028 List Sorting (25 分)   Excel can sort records according to any column. Now you are supposed to i ...

  3. PAT 甲级 1020 Tree Traversals (25分)(后序中序链表建树,求层序)***重点复习

    1020 Tree Traversals (25分)   Suppose that all the keys in a binary tree are distinct positive intege ...

  4. PAT 甲级 1146 Topological Order (25 分)(拓扑较简单,保存入度数和出度的节点即可)

    1146 Topological Order (25 分)   This is a problem given in the Graduate Entrance Exam in 2018: Which ...

  5. PAT 甲级 1071 Speech Patterns (25 分)(map)

    1071 Speech Patterns (25 分)   People often have a preference among synonyms of the same word. For ex ...

  6. PAT 甲级 1063 Set Similarity (25 分) (新学,set的使用,printf 输出%,要%%)

    1063 Set Similarity (25 分)   Given two sets of integers, the similarity of the sets is defined to be ...

  7. PAT 甲级 1059 Prime Factors (25 分) ((新学)快速质因数分解,注意1=1)

    1059 Prime Factors (25 分)   Given any positive integer N, you are supposed to find all of its prime ...

  8. PAT 甲级 1051 Pop Sequence (25 分)(模拟栈,较简单)

    1051 Pop Sequence (25 分)   Given a stack which can keep M numbers at most. Push N numbers in the ord ...

  9. PAT 甲级 1048 Find Coins (25 分)(较简单,开个数组记录一下即可)

    1048 Find Coins (25 分)   Eva loves to collect coins from all over the universe, including some other ...

  10. PAT 甲级 1037 Magic Coupon (25 分) (较简单,贪心)

    1037 Magic Coupon (25 分)   The magic shop in Mars is offering some magic coupons. Each coupon has an ...

随机推荐

  1. pytorch save model + Gmatch4py + jupyter debugger + community structure

    1. pytorch, 使用训练好的模型测试自己图片 2. [ pytorch ] ——基本使用:(2) 训练好的模型参数的保存以及调用 3. Gmatch4py 4. Network Analysi ...

  2. C++ vector的用法(转)

    原文链接:https://blog.csdn.net/qinyuehong/article/details/92837359

  3. 2019-08-05 纪中NOIP模拟B组

    T1 [JZOJ1432] 输油管道 题目描述 请你帮忙设计一个从城市M到城市Z的输油管道,现在已经把整个区域划分为R行C列,每个单元格可能是空的也可能是以下7种基本管道之一: 油从城市M流向Z,‘+ ...

  4. RS-232C

    RS-232C标准(协议)的全称是EIA-RS-232C标准,定义是"数据终端设备(DTE)和数据通讯设备(DCE)之间串行二进制数据交换接口技术标准".它是在1970年由美国电子 ...

  5. 题解【BZOJ4145】「AMPPZ2014」The Prices

    题目描述 你要购买 \(m\) 种物品各一件,一共有 \(n\) 家商店,你到第 \(i\) 家商店的路费为 \(d[i]\),在第 \(i\) 家商店购买第 \(j\) 种物品的费用为 \(c[i] ...

  6. 【音乐欣赏】《紅蓮華》 - LiSA

    曲名:紅蓮華 作者:LiSA [00:00.92]強くなれる理由を知った [00:07.34]僕を連れて 進め [00:18.74]泥だらけの走馬灯に酔う [00:24.37]強張る心 震える手は [ ...

  7. 在电竞圈想摧枯拉朽的AI,到底能带来什么?

    2019ChinaJoy,似乎并没有让这个暑期彻底燃动起来.在业界和玩家看来,2019ChinaJoy亮点匮乏.饱受诟病.不过细心观察的话,能够发现一个特殊现象--AI取代此前猎艳性质的cosplay ...

  8. 计算几何-Line-Left-Intersect

    This article is made by Jason-Cow.Welcome to reprint.But please post the article's address. 好好领悟一下ve ...

  9. vue环境搭建及单页面标签切换实例

    复习 """ 1.指令: v-once: <p v-once>{{ msg }}</p> v-cloak: 防止页面加载抖动 v-show:绑定的 ...

  10. 前端知识之css

    css的几种引入方式 行内样式 行内式是在标记的style属性中设定css样式,不推荐大规模使用 <p style='color:red'>hello world</p> 内部 ...