题目链接: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. react useRef()函数

    "ref"对象是一个通用容器,其current属性是可变的 保存dom function Test() { const t = useRef(null); useEffect(() ...

  2. Nestjs 身份验证

    文档 yarn add @nestjs/passport passport passport-http-bearer @nestjs/jwt passport-jwt auth.service.ts ...

  3. css 调转180度:transform: rotate(180deg);

    css 调转180度:transform: rotate(180deg);

  4. CSS div 高度满屏

    方法一: 通过JQuery,获取窗体的高度,设置给对应的div.代码如下 ht = $(document.body).height(); $(); 缺点:由于浏览器是先解析css,后执行JS,导致页面 ...

  5. linux考试题改错

    符号链接和硬链接有什么区别? 改:符号链接存储文件路径,可以指向不同分区文件,源文件删除后失效. 改:硬链接指向文件索引节点,仅能指向同一分区文件,源文件删除后可以访问. 请描述文件和目录9位权限位的 ...

  6. Linux:dd命令

    dd:“data duplicator” 意为数据复印机,它可以用来拷贝和转换数据. 备份和恢复整个硬盘或分区 备份MBR(主引导记录) 在ASCII和EBCDIC格式之间转换 也可以为Linux内核 ...

  7. js 事件模型

    说到事件,就要追溯到网景与微软的“浏览器大战”了.当时,事件模型还没有标准,两家公司的实现就是事实标准.网景在Navigator中实现了“事件捕获”的事件系统,而微软则在IE中实现了一个基本上相反的事 ...

  8. 初步了解Fork/Join框架

    框架介绍 Fork/Join框架是Java 7提供的一个用于并行执行任务的框架,是一个把大任务分割成若干个子任务,最终汇总每个子任务的执行结果以得到大任务结果的框架.Fork/Join框架要完成两件事 ...

  9. stellar.js 视差滚动

    1.引入包 <script src="js/jquery.min.js"></script> <script src="js/jquery. ...

  10. Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader sun.misc.Launcher$AppClassLoader@18b4aac2

    1.错误日志 Failed to load driver class com.mysql.jdbc.Driver from HikariConfig class classloader sun.mis ...