-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathGrading Problem
More file actions
31 lines (30 loc) · 858 Bytes
/
Grading Problem
File metadata and controls
31 lines (30 loc) · 858 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
/* Problem Link : https://www.hackerrank.com/challenges/grading/problem */
import java.io.*;
class Sol
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parseInt(br.readLine());
int[] grades=new int[n];
int[] g=new int[n];
int t,k;
for(int i=0;i<n;i++)
{
grades[i]=Integer.parseInt(br.readLine());
k=(grades[i])/5;
t=5*(k+1);
if(grades[i]>37)
{
if((t-grades[i])<3)
g[i]=t;
else
g[i]=grades[i];
}
if(grades[i]<=37)
g[i]=grades[i];
System.out.print(""+g[i]);
System.out.println("");
}
}
}