-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGradingStudents.java
More file actions
30 lines (26 loc) · 851 Bytes
/
GradingStudents.java
File metadata and controls
30 lines (26 loc) · 851 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
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
static int[] solve(int[] grades){
for(int i = 0; i < grades.length; i++)
if(grades[i]>=38 && grades[i]%5 != 0)
grades[i]+=((grades[i]%5>2)?(5-grades[i]%5):0);
return grades;
}
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int[] grades = new int[n];
for(int grades_i=0; grades_i < n; grades_i++){
grades[grades_i] = in.nextInt();
}
int[] result = solve(grades);
for (int i = 0; i < result.length; i++) {
System.out.print(result[i] + (i != result.length - 1 ? "\n" : ""));
}
System.out.println("");
}
}