马子豪


私信TA

用户名:1634091128

访问量:4217

签 名:

等  级
排  名 468
经  验 4588
参赛次数 0
文章发表 16
年  龄 0
在职情况 学生
学  校 湖北生物科技职业学院
专  业

  自我简介:

解题思路:

注意事项:

参考代码:


import java.util.HashMap;

import java.util.Map;

import java.util.Scanner;

public class class01 {

    public static void main(String[] args) {

     Scanner sc = new Scanner(System.in);

    int n=sc.nextInt();

    Map<String, Integer> map= new HashMap<String, Integer>();//str1[i][0]存储储输入的名字,str1[i][1]存储输入的分数

    String[] str=new String[n];

    for (int i = 0; i < n; i++) {

str[i]=sc.next(); //存储储输入的名字

}

    int m=sc.nextInt();

    for (int i = 0; i < m; i++) {

for (int j = 0; j < str.length; j++) {

int fs=sc.nextInt();

String name=sc.next();

map.put(name, fs);

}

         //默认排名为第一名

             int k=1;

             for (int s : map.values()) {

                 //寻找分数比达达高的人的人数

                 if (s>map.get("DaDa")) {

                     k++;

                 

             }

         

}

             System.out.println(k);

}

    }

    }


 

0.0分

4 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

.。。
2021-03-20 22:19:25
  • «
  • 1
  • »