Skip to content

Commit d4521eb

Browse files
committed
added 6th
1 parent 3966feb commit d4521eb

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

training-sheet/B/006. Coins.cpp

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
#include <bits/stdc++.h>
2+
#define lli long long int
3+
#define endl "\n"
4+
#define MAX 2005
5+
using namespace std;
6+
7+
8+
int main()
9+
{
10+
int a, b, c;
11+
a = b = c = 0;
12+
string s1, s2, s3;
13+
cin>>s1>>s2>>s3;
14+
15+
if(s1[1] == '>')
16+
{
17+
if(s1[0] == 'A')
18+
a++;
19+
else if(s1[0] == 'B')
20+
b++;
21+
else
22+
c++;
23+
}
24+
else
25+
{
26+
if(s1[2] == 'A')
27+
a++;
28+
else if(s1[2] == 'B')
29+
b++;
30+
else
31+
c++;
32+
}
33+
if(s2[1] == '>')
34+
{
35+
if(s2[0] == 'A')
36+
a++;
37+
else if(s2[0] == 'B')
38+
b++;
39+
else
40+
c++;
41+
}
42+
else
43+
{
44+
if(s2[2] == 'A')
45+
a++;
46+
else if(s2[2] == 'B')
47+
b++;
48+
else
49+
c++;
50+
}
51+
if(s3[1] == '>')
52+
{
53+
if(s3[0] == 'A')
54+
a++;
55+
else if(s3[0] == 'B')
56+
b++;
57+
else
58+
c++;
59+
}
60+
else
61+
{
62+
if(s3[2] == 'A')
63+
a++;
64+
else if(s3[2] == 'B')
65+
b++;
66+
else
67+
c++;
68+
}
69+
70+
if(a == b or b== c or c== a)
71+
cout<<"Impossible";
72+
73+
else if((a > b) && (a > c))
74+
{
75+
if(b > c)
76+
cout<<"CBA";
77+
else
78+
cout<<"BCA";
79+
}
80+
81+
else if((b >c) && (b > a))
82+
{
83+
if(a > c)
84+
cout<<"CAB";
85+
else
86+
cout<<"ACB";
87+
}
88+
else
89+
{
90+
if(a > b)
91+
cout<<"BAC";
92+
else
93+
cout<<"ABC";
94+
}
95+
96+
}

0 commit comments

Comments
 (0)