-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy path47B. Coins.cpp
58 lines (48 loc) · 975 Bytes
/
47B. Coins.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
/*
prblem link:http://codeforces.com/contest/47/problem/B
prblem name:47B. Coins;
status:accepted;
authour :moahnd sakr
*/
#include <iostream>
#include<string>
#include<map>
using namespace std;
int main() {
string arr[3]={};
for(int i=0;i<3;i++){
cin>>arr[i];
}
map<char,int> ma;
ma['A']=0;
ma['B']=0;
ma['C']=0;
for(int i=0;i<3;i++)
if(arr[i][1]=='>'){
++ma[arr[i][0]];
--ma[arr[i][2]];
}else {
--ma[arr[i][0]];
++ma[arr[i][2]];
}
//cout<<ma['A']<<" "<<ma['B']<<" "<<ma['C']<<endl;
if(ma['A']>ma['B']&&ma['B']>ma['C']){
cout<<"CBA";
}
else if (ma['A']>ma['C']&&ma['C']>ma['B']){
cout<<"BCA";
}
else if(ma['B']>ma['C']&&ma['C']>ma['A']){
cout<<"ACB";
}
else if(ma['B']>ma['A']&&ma['A']>ma['C'])
cout<<"CAB";
else if(ma['C']>ma['B']&&ma['B']>ma['A'])\
cout<<"ABC";
else if(ma['C']>ma['A']&&ma['A']>ma['B'])
cout<<"BAC";
else{
cout<<"Impossible";
}
return 0;
}