-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccesorii mobila.java
More file actions
38 lines (38 loc) · 1.09 KB
/
Accesorii mobila.java
File metadata and controls
38 lines (38 loc) · 1.09 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
import java.util.*;
public class ECCPR{
public static void main(String []args){
double n,nr,cnt=0;
int R=0,S=0,P=0,B=0,H=0;
char x;
Set<Character>s=new HashSet<Character>();
Scanner sc= new Scanner(System.in);
n=sc.nextInt();
for(int i=0;i<n;i++){
nr=sc.nextInt();
for(int j=0;j<nr;j++){
x=sc.next().charAt(0);
if(x=='R'){
R++;
}else if(x=='P'){
P++;
}else if(x=='S'){
S++;
}else if(x=='B'){
B++;
}else if(x=='H'){
H++;
}
s.add(x);
}
if((s.size()==5)&&(R%4==0)&&(P==S)&&(B%2==0)&&(H%2==0)&&(H<=P)){
System.out.print(1+" ");
}else{
System.out.print(0+" ");
cnt++;
}
R=0;S=0;P=0;B=0;H=0;
s.clear();
}
System.out.printf("/n%.2f",(cnt/n));
}
}