A. MUH and Sticks
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Two polar bears Menshykov and Uslada from the St.Petersburg zoo and elephant Horace from the Kiev zoo got six sticks to play with and assess the animals' creativity. Menshykov, Uslada and Horace decided to make either an elephant or a bear from those sticks. They can make an animal from sticks in the following way:

  • Four sticks represent the animal's legs, these sticks should have the same length.
  • Two remaining sticks represent the animal's head and body. The bear's head stick must be shorter than the body stick. The elephant, however, has a long trunk, so his head stick must be as long as the body stick. Note that there are no limits on the relations between the leg sticks and the head and body sticks.

Your task is to find out which animal can be made from the given stick set. The zoo keeper wants the sticks back after the game, so they must never be broken, even bears understand it.

Input

The single line contains six space-separated integers li (1 ≤ li ≤ 9) — the lengths of the six sticks. It is guaranteed that the input is such that you cannot make both animals from the sticks.

Output

If you can make a bear from the given set, print string "Bear" (without the quotes). If you can make an elephant, print string "Elephant" (wıthout the quotes). If you can make neither a bear nor an elephant, print string "Alien" (without the quotes).

Sample test(s)
input
4 2 5 4 4 4
output
Bear
input
4 4 5 4 4 5
output
Elephant
input
1 2 3 4 5 6
output
Alien
Note

If you're out of creative ideas, see instructions below which show how to make a bear and an elephant in the first two samples. The stick of length 2 is in red, the sticks of length 4 are in green, the sticks of length 5 are in blue.

sb模拟题

唯一的难点是……cf太卡交都交不上去

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<ctime>
#include<set>
#define LL long long
using namespace std;
inline LL read()
{
int x=0,f=1;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
LL a[10];
LL n,aa,bb;
LL s,mx,saves=-1;
int main()
{
for (int i=1;i<=6;i++)a[i]=read();
sort(a+1,a+7);
for (int i=1;i<=6;i++)
{
if(a[i]==a[i-1]||i==1)s++;
else s=1;
if(s==4) saves=a[i];
mx=max(mx,s);
}
if (mx<4)
{
printf("Alien\n");
return 0;
}
if (mx==6)
{
printf("Elephant\n");
return 0;
}
if (mx==5)
{
printf("Bear\n");
return 0;
}
for(int i=1;i<=6;i++)
if (a[i]!=saves)
{
if (!aa) aa=a[i];
else bb=a[i];
}
if (aa!=bb)
{printf("Bear\n");
}else printf("Elephant\n");
}

  

cf471A MUH and Sticks的更多相关文章

  1. 【CodeForces 471A】MUH and Sticks

    题 题意 给你六根木棍的长度,熊需要头比身体短,大象需要头和身体一样,四肢要一样长,否则就是外星人.请你判断能组成哪一个. 分析 暴力,循环看一下每根有几根相同的,然后如果有四根都是有四根相同的&am ...

  2. [CodeForces 471A] MUH and Sticks

    题目链接:http://codeforces.com/problemset/problem/471/A 题目数据规模1 - 9,可以用一个数组进行计数,减掉出现四次的数,看看还有几个是非零数,有一个就 ...

  3. HDOJ 1051. Wooden Sticks 贪心 结构体排序

    Wooden Sticks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) To ...

  4. POJ 2653 Pick-up sticks (线段相交)

    题意:给你n条线段依次放到二维平面上,问最后有哪些没与前面的线段相交,即它是顶上的线段 题解:数据弱,正向纯模拟可过 但是有一个陷阱:如果我们从后面向前枚举,找与前面哪些相交,再删除前面那些相交的线段 ...

  5. hduoj 1455 && uva 243 E - Sticks

    http://acm.hdu.edu.cn/showproblem.php?pid=1455 http://uva.onlinejudge.org/index.php?option=com_onlin ...

  6. POJ 2653 Pick-up sticks【线段相交】

    题意:n根木棍随意摆放在一个平面上,问放在最上面的木棍是哪些. 思路:线段相交,因为题目说最多有1000根在最上面.所以从后往前处理,直到木棍没了或者最上面的木棍的总数大于1000. #include ...

  7. POJ1065Wooden Sticks[DP LIS]

    Wooden Sticks Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 21902   Accepted: 9353 De ...

  8. 【POJ 2653】Pick-up sticks 判断线段相交

    一定要注意位运算的优先级!!!我被这个卡了好久 判断线段相交模板题. 叉积,点积,规范相交,非规范相交的简单模板 用了“链表”优化之后还是$O(n^2)$的暴力,可是为什么能过$10^5$的数据? # ...

  9. CF451A Game With Sticks 水题

    Codeforces Round #258 (Div. 2) Game With Sticks A. Game With Sticks time limit per test 1 second mem ...

随机推荐

  1. 在CDHtmlDialog中处理WindowClosing

    要截获window.close(),就得截获CDHtmlDialog的WindowClosing.以下是示例代码: // header DECLARE_EVENTSINK_MAP() void Win ...

  2. PhpForm表单相关的超全局变量操作

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. poj2242

                                                        The Circumference of the Circle Time Limit: 1000 ...

  4. Hive 10、Hive的UDF、UDAF、UDTF

    Hive自定义函数包括三种UDF.UDAF.UDTF UDF(User-Defined-Function) 一进一出 UDAF(User- Defined Aggregation Funcation) ...

  5. UNIX时间戳与日期的相互转换

    mysql中UNIX时间戳与日期的相互转换 UNIX时间戳转换为日期用函数:FROM_UNIXTIME() select FROM_UNIXTIME(1410318106); 日期转换为UNIX时间戳 ...

  6. GCD 倒计时

    今天在Code4App上看了一个GCD倒计时的Demo,觉得不错代码贴出来备用 -(void)startTime{ __block ; //倒计时时间 dispatch_queue_t queue = ...

  7. 由查找session IP 展开---函数、触发器、包

    由查找session IP 展开---函数.触发器.包 一.userenv函数.sys_context函数 --查看当前client会话的session IP信息 SQL>select sys_ ...

  8. iOS8 Core Image In Swift:人脸检测以及马赛克

    iOS8 Core Image In Swift:自动改善图像以及内置滤镜的使用 iOS8 Core Image In Swift:更复杂的滤镜 iOS8 Core Image In Swift:人脸 ...

  9. jquery模仿css3延迟效果

    HTML <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta ...

  10. 失效的URL访问限制(转)

    * 经常URL的保护仅仅是连接到该页面的链接不出现在未授权的用户面前.然而,一个有动机的.熟练的或者仅仅是幸运的黑客可能会找到并访问这些网页 , 调用这些功能并查看数据.在应用程序中,通过隐匿来实现安 ...