-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBurse studentesti.java
More file actions
41 lines (40 loc) · 1.27 KB
/
Burse studentesti.java
File metadata and controls
41 lines (40 loc) · 1.27 KB
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
34
35
36
37
38
39
40
41
import java.util.*;
public class ECCPR{
public static void main(String []args){
int n,m,b;
double medie=0;
String nume;
int nr;
boolean ok=true;
Scanner sc=new Scanner(System.in);
TreeMap<Double,String>list=new TreeMap<Double,String>();
n=sc.nextInt();
m=sc.nextInt();
b=sc.nextInt();
sc.nextLine();
for(int i=0;i<n;i++){
nume=sc.nextLine();
for(int j=0;j<m;j++){
nr=sc.nextInt();
if(nr>=5){
medie+=nr;
}else ok=false;
}
if(ok==true&&medie/m>=8){
list.put(medie/m,nume);
}
sc.nextLine();
ok=true;
medie=0;
}
if(list.size()>b){
System.out.println(b);
System.out.print(list.values().toArray()[list.size()-1]+" ");
System.out.printf("%.2f",list.keySet().toArray()[list.size()-1]);
}else{
System.out.println(list.size()-1);
System.out.print(list.values().toArray()[list.size()-1]+" ");
System.out.printf("%.2f",list.keySet().toArray()[list.size()-1]);
}
}
}