Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Lab {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int times = Integer.parseInt(scanner.nextLine());
- Map<String, Double[]> grades = new TreeMap<>();
- while (times-- > 0) {
- String student = scanner.nextLine();
- String[] SeparatedScores = scanner.nextLine().split("\\s+");
- Double[] scores = new Double[SeparatedScores.length];
- for (int i = 0; i < SeparatedScores.length; i++) {
- scores[i] = Double.parseDouble(SeparatedScores[i]);
- }
- grades.put(student, scores);
- }
- for (Map.Entry<String,Double[]>enter:grades.entrySet()) {
- System.out.println(enter.getKey()+" is graduated with "+enter.getValue());
- }
- }
- }
- //Gosho is graduated with 4.375
- //3
- //Gosho
- //3.75 5
- //Mara
- //4.25 6
- //Pesho
- //6 4.5
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement