设为首页 加入收藏

TOP

Codeforces Round #269 (Div. 2)
2015-07-20 17:36:07 来源: 作者: 【 】 浏览:2
Tags:Codeforces Round #269 Div.

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.

    \

    <??http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcD4KPHA+zOLS4qO6xKPE4suuzOI8L3A+CjxwPjxwcmUgY2xhc3M9"brush:java;">#include #include #include #include #include using namespace std; int main() { map mp; mp.clear(); int f[6]; for (int i = 0; i < 6; i++) { scanf("%d", &f[i]); mp[f[i]]++; } int flag = 0; for (int i = 0; i < 6; i++) if (mp[f[i]] >= 4) { mp[f[i]] -= 4; flag = 1; break; } if (!flag) { printf("Alien\n"); return 0; } flag = 0; for (int i = 0; i < 6; i++) if (mp[f[i]] == 2) flag = 1; if (flag) printf("Elephant\n"); else printf("Bear\n"); return 0; }



】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇hdu 3911 Black And White(线段树) 下一篇hdu 2521 一卡通大冒险 (斯特灵数..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·Redis 分布式锁全解 (2025-12-25 17:19:51)
·SpringBoot 整合 Red (2025-12-25 17:19:48)
·MongoDB 索引 - 菜鸟 (2025-12-25 17:19:45)
·What Is Linux (2025-12-25 16:57:17)
·Linux小白必备:超全 (2025-12-25 16:57:14)