当前位置:网站首页>1004 成绩排名 (20 分)
1004 成绩排名 (20 分)
2022-08-05 05:16:00 【呆比特】
1004 成绩排名 (20 分)
题目要求:
代码:
import java.util.Scanner;
import java.util.TreeMap;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
//輸入
int n = scan.nextInt();
scan.nextLine();
/* * 因为题目保证每个学生成绩不相同,且需要排序 * 因此选择使用TreeMap,key保存成绩,value保存要输出的信息,TreeMap默认升序 * */
TreeMap<Integer, String> map = new TreeMap<>();
for (int i = 0; i < n; i++) {
String str = scan.nextLine();
String[] s = str.split(" ");
map.put(Integer.valueOf(s[2]),s[0] + " " + s[1]);
}
//直接输出
System.out.println(map.get(map.lastKey()));
System.out.println(map.get(map.firstKey()));
}
}
结果:
边栏推荐
- [Pytorch study notes] 11. Take a subset of the Dataset and shuffle the order of the Dataset (using Subset, random_split)
- 八、响应处理——ReturnValueHandler匹配返回值处理器并处理返回值原理解析
- You should write like this
- 6k+ star,面向小白的深度学习代码库!一行代码实现所有Attention机制!
- 轻松接入Azure AD+Oauth2 实现 SSO
- OSPF网络类型
- 【论文精读】Rich Feature Hierarchies for Accurate Object Detection and Semantic Segmentation(R-CNN)
- OSPF故障排除办法
- 【nodejs】第一章:nodejs架构
- 如何停止flink job
猜你喜欢

Mysql-连接https域名的Mysql数据源踩的坑
![[Pytorch study notes] 10. How to quickly create your own Dataset dataset object (inherit the Dataset class and override the corresponding method)](/img/71/f82e76085f9d8e6610f6f817e2148f.png)
[Pytorch study notes] 10. How to quickly create your own Dataset dataset object (inherit the Dataset class and override the corresponding method)

【数据库和SQL学习笔记】9.(T-SQL语言)定义变量、高级查询、流程控制(条件、循环等)
![[Intensive reading of the paper] R-CNN's Bounding box regression problem is detailed](/img/ef/a058ec08bd0a6313e3610a4ebc9685.png)
[Intensive reading of the paper] R-CNN's Bounding box regression problem is detailed

Day1:用原生JS把你的设备变成一台架子鼓!

关于存储IOPS你必须了解的概念

【Pytorch学习笔记】8.训练类别不均衡数据时,如何使用WeightedRandomSampler(权重采样器)

11%的参数就能优于Swin,微软提出快速预训练蒸馏方法TinyViT

读论文- pix2pix

MSRA proposes extreme masking model ExtreMA for learning instances and distributed visual representations
随机推荐
【Pytorch学习笔记】10.如何快速创建一个自己的Dataset数据集对象(继承Dataset类并重写对应方法)
[After a 12] No record for a whole week
基于Flink CDC实现实时数据采集(一)-接口设计
flink部署操作-flink on yarn集群安装部署
OSPF故障排除办法
「实用」运维新手一定不能错过的17 个技巧
SQL (2) - join window function view
RecycleView和ViewPager2
【ts】typescript高阶:typeof使用
伪RTOS-ProroThread在CH573芯片上的移植
基于STM32F407的WIFI通信(使用的是ESP8266模块)
如何停止flink job
2022年中总结关键词:裁员、年终奖、晋升、涨薪、疫情
数据库期末考试,选择、判断、填空题汇总
Flink EventTime和Watermarks案例分析
【数据库和SQL学习笔记】4.SELECT查询2:排序(ORDER BY)、聚合函数、分组查询(GROUP BY)
吞吐?带宽?傻傻分不清楚
Flink HA配置
Spark ML学习相关资料整理
[Go through 11] Random Forest and Feature Engineering