-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathI018.java
73 lines (68 loc) · 2.27 KB
/
I018.java
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package levelB;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class I018 {
public static void main(String[] args) throws Exception {
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int N=Integer.parseInt(br.readLine());
int count_jia[]=new int[3];//甲的获胜次数,数组从左到右代表J C B
int count_yi[]=new int[3];
int ping=0;
for(int i=0;i<N;i++){
char[] c=br.readLine().toCharArray();
char jia=c[0];
char yi=c[2];
if(jia=='C'){
if(yi=='C'){
ping++;
}else if(yi=='B'){
count_yi[2]++;
}else{
count_jia[1]++;
}
}else if(jia=='B'){
if(yi=='B'){
ping++;
}else if(yi=='C'){
count_jia[2]++;
}else{
count_yi[0]++;
}
}else{
if(yi=='J'){
ping++;
}else if(yi=='B'){
count_jia[0]++;
}else{
count_yi[1]++;
}
}
}
System.out.println(count_jia[0]+count_jia[1]+count_jia[2]+" "+ping+" "+(N-ping-(count_jia[0]+count_jia[1]+count_jia[2])));
System.out.println(count_yi[0]+count_yi[1]+count_yi[2]+" "+ping+" "+(N-ping-(count_yi[0]+count_yi[1]+count_yi[2])));
int max=0,index=0;
for(int i=0;i<3;i++){
if(max<=count_jia[i]){
max=count_jia[i];
index=i;
}
}
switch(index){
case 0:System.out.print("J ");break;
case 1:System.out.print("C ");break;
case 2:System.out.print("B ");break;
}
max=0;index=0;
for(int i=0;i<3;i++){
if(max<=count_yi[i]){
max=count_yi[i];
index=i;
}
}
switch(index){
case 0:System.out.print("J");break;
case 1:System.out.print("C");break;
case 2:System.out.print("B");break;
}
}
}