A - MUH and Sticks(471A - MUH and Sticks)


  1. 471A - MUH and Sticks
  2. #include<bits/stdc++.h>
  3. using namespace std;
  4. int main(){
  5. int a[6];
  6. for(int i=0;i<6;i++){
  7. cin>>a[i];
  8. }
  9. sort(a,a+6);
  10. multiset<int>x{a,a+6};
  11. set<int>y{a,a+6};
  12. int c=0 ;
  13.  
  14. c=x.count(a[3]);
  15. int s = y.size();
  16. //cout<<c<<s;
  17. int z=a[0];
  18. for(int i=0;i<6;i++){
  19. if(a[i]!=a[3]) {z=a[i]; break;}
  20. }
  21. if( c==6 ){ cout<<"Elephant";
  22. }
  23. else if(c==4 and ((z==a[4] and z==a[5]) or ( z==a[0] and z==a[1])) ){
  24. cout<<"Elephant"; }
  25.  
  26. else if(s<=3 and c>3 or c==5){ cout<<"Bear";
  27.  
  28. }
  29. else cout<<"Alien";
  30. return 0;
  31. }

Comments

Popular posts from this blog

Codeforce Problem 1703A. YES or YES?

Aptitude test assistant programmer 2018

1041A. Heist solution