当前位置:网站首页>Pat 1083 list grades (25 points)
Pat 1083 list grades (25 points)
2022-06-25 21:34:00 【Python ml】
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct stu{
char name[11],ID[11];
int grade;
};
bool cmp(stu a,stu b){
return a.grade>b.grade; // Because every student ⽣ Their grades are different , So you can arrange them in descending order ,return a.grade > b.grade
}
int main() {
int n,low,high,cnt=0;
cin>>n;
vector<stu>a(n);
for(int i=0;i<n;i++)
scanf("%s %s %d",&a[i].name,&a[i].ID,&a[i].grade); //cin>>a[i].name>>a[i].ID>>a[i].grade;
scanf("%d %d",&low,&high);
sort(a.begin(),a.end(),cmp);
for(int i=0;i<a.size();i++){
if(a[i].grade<=high&&a[i].grade>=low){
printf("%s %s\n",a[i].name,a[i].ID);
cnt++; // Number of qualified students
}else if(a[i].grade<low) break;
}
if(cnt==0) printf("NONE");
return 0;
}
边栏推荐
- Q5 s905l firmware version 202109
- STM32 self balancing robot project, with code, circuit diagram and other data attached at the end (learning materials and learning group at the end)
- Unable to connect to the server remotely locally using the Jupiter notebook
- 数字图像处理知识点总结概述
- Php7.4 arm environment compilation and installation error invalid 'ASM': invalid operate prefix '%c'
- multiplication table
- 109 practical shell scripts
- Virtualenvwrapper solves the installation error, and virtualenvwrapper is permanently effective
- If switch branch structure
- Common optimization of e-commerce server system architecture
猜你喜欢
Differences between modems and routers (powercert animated videos)
CANoe. Diva operation guide TP layer test
熊市指南|一些本质的教训与具体的生存法则
Xshell mouse configuration
Jmeter- (I) installation of interface test
PHP runtime and memory consumption statistics code
Idea implements hot deployment
On ACM competition
智云健康上市在即:长期亏损,美年健康俞熔已退出,未来难言乐观
[nailing scenario capability package] company / Park Digital canteen
随机推荐
js(3)
银河证券靠谱吗?开证券账户安全吗?
Is flush app regular? Is it safe or not
What is ARP (address resolution protocol)? (Powercert animated videos)
Illustration tcp/ip - Chapter 3 and 4 notes
On ACM competition
Openocd compilation and installation
Nmap is simple and practical
Common singleton functions traverse dictionary functions
Jmeter- (I) installation of interface test
Getting started and using postman
The user name and password will be automatically filled in when adding a form
Canoe learning notes (1)
js 限制鼠标移动范围
Beginner to embedded development
Please enter an integer and output it as several digits, and output each digit in reverse order.
OLED driven learning based on ssd1306 (II): addressing mode of ssd1306
How testers write functional test cases
Support JPEG format in GD Library in php7.4
Compile 6relayd using the cross compiler