[CodeForces 471A] MUH and Sticks
题目链接: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的更多相关文章
- cf471A MUH and Sticks
A. MUH and Sticks time limit per test 1 second memory limit per test 256 megabytes input standard in ...
- 【CodeForces 471A】MUH and Sticks
题 题意 给你六根木棍的长度,熊需要头比身体短,大象需要头和身体一样,四肢要一样长,否则就是外星人.请你判断能组成哪一个. 分析 暴力,循环看一下每根有几根相同的,然后如果有四根都是有四根相同的&am ...
- CodeForces 471C MUH and House of Cards
MUH and House of Cards Time Limit:1000MS Memory Limit:262144KB 64bit IO Format:%I64d & % ...
- codeforces 471C.MUH and House of Cards 解题报告
题目链接:http://codeforces.com/problemset/problem/471/C 题目意思:有 n 张卡,问能做成多少种不同楼层(floor)的 house,注意这 n 张卡都要 ...
- codeforces 471B. MUH and Important Things 解题报告
题目链接:http://codeforces.com/problemset/problem/471/B 题目意思:有 n 个 tasks,编号依次为 1 - n,每个 task 都有一定的难度值来评估 ...
- Codeforces #317 C.Lengthening Sticks(数学)
C. Lengthening Sticks time limit per test 1 second memory limit per test 256 megabytes input standar ...
- 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 ...
- 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 ...
- 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 ...
随机推荐
- react 使用 lazyload 懒加载图片
文档地址 index.html <script> (function(w, d) { var b = d.getElementsByTagName("body")[0] ...
- mac下supervisor安装及简单配置
supervisor是一个用 Python 写的进程管理工具,可以很方便的用来启动.重启.关闭进程(守护进程).可以用他来管理自己的“服务程序”. 安装 首先安装Python,Mac系统好像自带. 执 ...
- juqery 回车事件 回车操作 回车搜索
html <form class="search_wrap" method="post" action=""> <div ...
- 9 个用于移动APP开发的顶级 JavaScript 框架【申明:来源于网络】
9 个用于移动APP开发的顶级 JavaScript 框架[申明:来源于网络] 地址:http://www.codeceo.com/article/9-app-javascript-framework ...
- 如何在一个电脑上使用两个github账号
问题描述:公司电脑上默认使用的是公司的github账号,如果希望写一些代码放到个人的github账号上,就需要配置让一个电脑上可以使用两个github账号 原理:管理两个SSH key 1.生成两个S ...
- 深入理解Java虚拟机6-chap8-9-斗者3星
一.虚拟机字节码执行引擎 1.虚拟机执行引擎由自己实现,所以可以自行制定指令集与执行引擎的体系结构,并且可以执行那些不被硬件直接支持的指令集格式. 2.执行引擎 编译执行:通过JIT编译器产生本地代码 ...
- 外网无法ip访问服务器解决方法 (原)
示例ip:119.75.1.1 windows server示例 一.检查网络是否通畅 打开dos窗口(windows+r , 输入cmd回车 )输入命令: ping 119.75 ...
- Mybatis入门及于hibernate的区别
pojo:不按mvc分层,只是java bean有一些属性,还有get set方法domain:不按mvc分层,只是java bean有一些属性,还有get set方法po:用在持久层,还可以再增加或 ...
- Qt 的坐标系统
QWidget *q = , Qt::WindowStaysOnTopHint); q->setWindowTitle(QObject::tr("父窗口widget")); ...
- CentOS 7 源码编译MariaDB
下载源码包 安装 SCL devtoolset-7 SCL(Software Collections)可以让你在同一个操作系统上安装和使用多个版本的软件,而不会影响整个系统的安装包.SCL为社区的以 ...