-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolution.java
More file actions
25 lines (22 loc) · 836 Bytes
/
Solution.java
File metadata and controls
25 lines (22 loc) · 836 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
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner in = new Scanner(System.in);
int n = in.nextInt();
for (int i = 0; i < n; i++) {
int grade = in.nextInt();
if (grade < 38) {
System.out.println(grade);
} else {
int fiveMultiple = (int) Math.ceil((double) grade/5) * 5;
int diff = fiveMultiple - grade;
if(diff < 3) {
System.out.println(fiveMultiple);
} else {
System.out.println(grade);
}
}
}
}
}