当前位置:网站首页>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()));
}
}
结果:
边栏推荐
- Flink HA配置
- OSPF故障排除办法
- Comparison and summary of Tensorflow2 and Pytorch in terms of basic operations of tensor Tensor
- spark-DataFrame数据插入mysql性能优化
- [Skill] Long-term update
- 【数据库和SQL学习笔记】7.SQL中的插入(INSERT)、删除(DELETE)、更新(UPDATE)
- ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!
- 2022年中总结关键词:裁员、年终奖、晋升、涨薪、疫情
- 【ts】typescript高阶:typeof使用
- 基于Flink CDC实现实时数据采集(三)-Function接口实现
猜你喜欢

【shell编程】第三章:函数

哥廷根大学提出CLIPSeg,能同时作三个分割任务的模型

IDEA 配置连接数据库报错 Server returns invalid timezone. Need to set ‘serverTimezone‘ property.

网络ID,广播地址,掩码位数计算

读论文- pix2pix
![[Database and SQL study notes] 8. Views in SQL](/img/22/82f91388f06ef4f9986bf1e90800f7.png)
[Database and SQL study notes] 8. Views in SQL

flink yarn-session的两种使用方式

Comparison and summary of Tensorflow2 and Pytorch in terms of basic operations of tensor Tensor

CVPR最佳论文得主清华黄高团队提出首篇动态网络综述

【ts】typescript高阶:模版字面量类型
随机推荐
SharedPreferences and SQlite database
服务网格istio 1.12.x安装
[After a 12] No record for a whole week
RecycleView和ViewPager2
基于Flink CDC实现实时数据采集(三)-Function接口实现
SQL (2) - join window function view
CVPR2021 - Inception Convolution with Efficient Dilation Search
基于STM32F4的FFT+测频率幅值相位差,波形显示,示波器,时域频域分析相关工程
如何组织一场安全、可靠、高效的网络实战攻防演习?
2021电赛资源及经验总结
[Kaggle project actual combat record] Steps and ideas sharing of a picture classification project - taking leaf classification as an example (using Pytorch)
【Pytorch学习笔记】11.取Dataset的子集、给Dataset打乱顺序的方法(使用Subset、random_split)
「实用」运维新手一定不能错过的17 个技巧
面向小白的深度学习代码库,一行代码实现30+中attention机制。
数控直流电源
Comparison and summary of Tensorflow2 and Pytorch in terms of basic operations of tensor Tensor
AIDL详解
The University of Göttingen proposed CLIPSeg, a model that can perform three segmentation tasks at the same time
单变量线性回归
【论文精读】R-CNN 之预测框回归(Bounding box regression)问题详述