zoukankan      html  css  js  c++  java
  • cf471A MUH and Sticks

    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
    ");
    		return 0;
    	}
    	if (mx==6)
    	{
    		printf("Elephant
    ");
    		return 0;
    	}
    	if (mx==5)
    	{
    		printf("Bear
    ");
    		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
    ");
    	}else printf("Elephant
    ");
    }
    

      

    ——by zhber,转载请注明来源
  • 相关阅读:
    Auto X2021 K Increasing Sequence
    拉普拉斯平滑处理 Laplace Smoothing
    博学之
    Python-生成音乐-pyshnth
    Python-Kivy ImportError: DLL load failed: 找不到指定的模块
    Python-Word模板填充-docxtpl
    Python-文字转语音-pyttsx3
    Virtual Box中Ubuntu使用"桥接网卡"不能联网而使用"网络地址转换(NAT)"却可以上网
    STM32的HAL库中的DMA_FLAG_TCIF3_7等几个宏定义的含义
    Linux下编写互相通信的驱动模块并将其加入到内核中
  • 原文地址:https://www.cnblogs.com/zhber/p/4035902.html
Copyright © 2011-2022 走看看