-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
31 lines (27 loc) · 909 Bytes
/
Solution.java
File metadata and controls
31 lines (27 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
public class Solution {
private static final Scanner scan = new Scanner(System.in);
public static void main(String[] args) {
int gradesCount = scan.nextInt();
List<Integer> grades = new ArrayList<>();
for (int i = 0; i < gradesCount; i++) {
grades.add(scan.nextInt());
}
scan.close();
System.out.println();
Result.gradingStudents(grades).forEach(System.out::println);
}
}
class Result {
public static List<Integer> gradingStudents(List<Integer> grades) {
return grades.stream()
.map(grade -> {
if (grade >= 38 && 5 - grade % 5 < 3) grade += 5 - grade % 5;
return grade;
})
.collect(Collectors.toList());
}
}