-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathC439A.java
More file actions
33 lines (26 loc) · 795 Bytes
/
Copy pathC439A.java
File metadata and controls
33 lines (26 loc) · 795 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
32
33
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class C439A {
/***/
public static void main(String[] args) {
BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
try{
String[] s=reader.readLine().trim().split(" ", 2);
int n=Integer.valueOf(s[0].trim()).intValue();
int d=Integer.valueOf(s[1].trim()).intValue();
s=reader.readLine().trim().split(" ", n);
int sumSongs=0;
int[] songs=new int[n];
for(int i=0;i!=n;i++){
songs[i]=Integer.valueOf(s[i].trim()).intValue();
sumSongs+=songs[i];
}
int min=sumSongs+(10*(n-1));
if(min<=d){
int minJokes=d-min;
System.out.println((minJokes/5)+(2*(n-1)));
}else System.out.println(-1);
reader.close();
}catch(Exception e){}
}
}