forked from Prince-1501/Hello_world-Competiitve-Programming
-
Notifications
You must be signed in to change notification settings - Fork 1
/
53_codeforces_MUH_and_sticks.cpp
80 lines (69 loc) · 1.6 KB
/
53_codeforces_MUH_and_sticks.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
//
// main.cpp
// code
//
// Created by Prince Kumar on 07/09/19.
// Copyright © 2019 Prince Kumar. All rights reserved.
//
// codeforces --> MUH and Sticks
#include <iostream>
using namespace std;
int main()
{
int a[10]={0};
for(int i=1;i<=6;i++)
{
int x; cin>>x;
a[x]++;
}
int leg =0;
int leg_value=0;
for(int i=1;i<=9;i++)
{
if(a[i]>=4)
{
leg=1;
leg_value=i;
a[i]=a[i]-4;
break;
}
}
int body=0;
int body_value=0;
for(int i=1;i<=9;i++)
{
if(a[i]>=1)
{
body=1;
body_value=i;
a[i]=a[i]-1;
break;
}
}
int head=0;
int head_value=0;
for(int i=1;i<=9;i++)
{
if(a[i]>=1)
{
head=1;
head_value=i;
a[i]=a[i]-1;
break;
}
}
// we got leg leg_value / body body_value / head head_value
if(leg==1 && body==1 && head==1)
{
if(leg_value!=head_value && leg_value!=body_value && head_value!=body_value)
cout<<"Bear"<<endl;
else if(body_value!=head_value && (leg_value!=head_value || leg_value!=body_value))
cout<<"Bear"<<endl;
else if(leg_value!=head_value && leg_value!=body_value && head_value==body_value)
cout<<"Elephant"<<endl;
else if(leg_value==head_value && leg_value==body_value && head_value==body_value)
cout<<"Elephant"<<endl;
}
else
cout<<"Alien"<<endl;
}