-
Notifications
You must be signed in to change notification settings - Fork 0
/
1018_shitoujiandaobu.cpp
96 lines (94 loc) · 1.67 KB
/
1018_shitoujiandaobu.cpp
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include<iostream>
using namespace std;
int fin(int a[3])
{
int max_num=0,max_flag;
for(int i=0;i<3;i++)
{
if(a[i]>max_num)
{
max_num=a[i];
max_flag=i;
}
}
return max_flag;
}
int main()
{
int tim,j;
cin>>tim;
char sor1,sor2;
int a_win=0,eql=0,flag=0;
int win[2][3]={0};
for(int i=tim;i>0;i--)
{
cin>>sor1>>sor2;
switch(sor1)
{
case 'B':
switch(sor2)
{
case 'B':eql++;
break;
case 'C':a_win++;
win[0][0]++;
break;
case 'J':
win[1][2]++;
break;
}
break;
case 'C':
switch(sor2)
{
case 'B':
win[1][0]++;
break;
case 'C':
eql++;
break;
case 'J':
a_win++;
win[0][1]++;
break;
}
break;
case 'J':
switch(sor2)
{
case 'B':
a_win++;
win[0][2]++;
break;
case 'J':
eql++;
break;
case 'C':
win[1][1]++;
break;
}
break;
}
}
cout<<a_win<<" "<<eql<<" "<<tim-a_win-eql<<endl;
cout<<tim-a_win-eql<<" "<<eql<<" "<<a_win<<endl;
for(int i=0;i<2;i++)
{
j=fin(win[i]);
switch(j)
{
case 0:cout<<"B";
break;
case 1:cout<<"C";
break;
case 2:cout<<"J";
break;
}
if(flag==0)
{
cout<<" ";
flag++;
}
}
cout<<endl;
}