题目链接:http://codeforces.com/problemset/problem/471/A

题目数据规模1 ~ 9,可以用一个数组进行计数,减掉出现四次的数,看看还有几个是非零数,有一个就是大象,有两个就是北极熊;如果没有四个数的,那就是Alien。

AC代码:

#include <cstdio>

using namespace std;

int cnt[10];
int x, id; int main() {
id = 0;
cnt[10] = {0};
for (int i = 0; i < 6; i++) {
scanf("%d", &x);
cnt[x]++;
if (cnt[x] == 4) {
id = x;
}
}
if (!id) {
puts("Alien");
return 0;
}
cnt[id] -= 4;
int ans = 0;
for (int i = 0; i < 10; i++) {
if (cnt[i]) {
ans++;
}
}
if (ans == 1) {
puts("Elephant");
} else {
puts("Bear");
}
return 0;
}

[CodeForces 471A] MUH and Sticks的更多相关文章

  1. cf471A MUH and Sticks

    A. MUH and Sticks time limit per test 1 second memory limit per test 256 megabytes input standard in ...

  2. 【CodeForces 471A】MUH and Sticks

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

  3. CodeForces 471C MUH and House of Cards

    MUH and House of Cards Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & % ...

  4. codeforces 471C.MUH and House of Cards 解题报告

    题目链接:http://codeforces.com/problemset/problem/471/C 题目意思:有 n 张卡,问能做成多少种不同楼层(floor)的 house,注意这 n 张卡都要 ...

  5. codeforces 471B. MUH and Important Things 解题报告

    题目链接:http://codeforces.com/problemset/problem/471/B 题目意思:有 n 个 tasks,编号依次为 1 - n,每个 task 都有一定的难度值来评估 ...

  6. Codeforces #317 C.Lengthening Sticks(数学)

    C. Lengthening Sticks time limit per test 1 second memory limit per test 256 megabytes input standar ...

  7. CodeForces 471D MUH and Cube Walls -KMP

    Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of ...

  8. codeforces 572 C. Lengthening Sticks(数学)

    题目链接:http://codeforces.com/contest/572/problem/C 题意:给出a,b,c,l要求a+x,b+y,c+z构成三角形,x+y+z<=l,成立的x,y,z ...

  9. Codeforces 832A. Sasha and Sticks

    It's one more school day now. Sasha doesn't like classes and is always bored at them. So, each day h ...

随机推荐

  1. Nest.js 管道

    Docs: https://docs.nestjs.com/pipes 管道将输入数据转换为所需的输出.此外,它可以处理验证,当数据不正确时可能会抛出异常. 内置的 pipe import { Arg ...

  2. electron+react

    yarn create react-app electron-react cd electron-react yarn run eject // 修改react-app打包的路径 / -> ./ ...

  3. 24、设计模式、webpack

    利用静态属性:长驻内存 (一) 单例模式 概念:单个实例,只有一个对象,多次创建,返回同一个对象. 单例模式的核心:==确保只有一个实例==,并提供全局访问. //利用了静态属性:长驻内存 funct ...

  4. 13、cookie

    一.cookie: 1.cookie cookie的应用: 1.用户名密码 自动登录 2.购物车商品的保存. <1>缓存信息,只存储特定的重要的信息.程序编程完成.缓存信息cookie技术 ...

  5. Moving Tables---(贪心)

    Problem Description The famous ACM (Advanced Computer Maker) Company has rented a floor of a buildin ...

  6. FatMouse' Trade(杭电ACM---1009)

    FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)T ...

  7. Linux 安装mysql mariadb配置

    CentOS 7.0 使用 yum 安装 MariaDB 与 MariaDB 的简单配置 1.安装MariaDB 安装命令 yum -y install mariadb mariadb-server ...

  8. 图->有向无环图->拓扑排序

    文字描述 关于有向无环图的基础定义: 一个无环的有向图称为有向无环图,简称DAG图(directed acycline graph).DAG图是一类较有向树更一般的特殊有向图. 举个例子说明有向无环图 ...

  9. sql 范式:1NF、2NF、3NF、BCNF(函数依赖)

    第一范式(1NF) 每个属性都是不可分的基本数据项.(必须有主键,列不可分) eg:非第一范式的表:(列可再分) 学院名称 高级职称人数 教授 副教授 信电学院 3 34 管理学院 5 23 外语学院 ...

  10. androidj基础:从网上下载图片

    一.布局文件 设置界面,添加一个ImageView,和两个Button按钮,设置其属性及id <ImageView android:id="@+id/ImageView" a ...