题目链接: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. elk之elasticsearch(二)

    一.下载安装包:注意版本统一 wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.zip wge ...

  2. spring-boot 集成 log4j 记录日志

    1.pom文件中移除和添加依赖 <!-- 移除boot—starter 的log4j --> <dependency> <groupId>org.springfra ...

  3. Oracle课程档案,第八天

    存储管理 查询块的大小:show parameter db_block_size database:数据库 tablespace:表空间 datafile:数据文件 segments:段 extent ...

  4. CentOS7.6 安装Docker

    删除已安装的Docker # Uninstall installed docker sudo yum remove docker \ docker-client \ docker-client-lat ...

  5. 线程安全 Thread Safety Problem scala concurrency 并发

    小结: 1.基于java并发模型 Scala concurrency is built on top of the Java concurrency model. 2. 将每个请求放入一个新的线程 T ...

  6. Linux 中的 Install命令

    Linux 中的 Install命令 更新时间:2017年09月25日 16:51:45   投稿:mrr   我要评论 install命令的作用是安装或升级软件或备份数据,它的使用权限是所有用户. ...

  7. 常用oracle hints

    在SQL语句优化过程中,经常会用到hint, 以下是在SQL优化过程中常见Oracle中"HINT"的30个用法 1. /*+ALL_ROWS*/ 表明对语句块选择基于开销的优化方 ...

  8. 万能poi导入功能模板

    同时支持2007版本和2003版本,空行过滤,纯数字类型数据格式处理,日期格式处理等 package com.yss.db.util; import com.yss.base.common.excep ...

  9. 网络视频播放ZFPlayer

    根据项目需要,公司app需要用到视频播放功能,推荐ZFPlayer,视频播放几乎有你想要的任何样式,该博客只是为了给自己留一个以后查找的资料, 改代码可以使用ZFPlayer github地址 htt ...

  10. git常用命令--tag

    /// 查看标签 // 打印所有标签 git tag // 打印符合检索条件的标签 git tag -l 1.*.* // 查看对应标签状态 git checkout 1.0.0 /// 创建标签(本 ...