[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 ...
随机推荐
- thinkphp5中使用PHPExcel(转载)
thinkphp5中可以使用composer来获取第三方类库,使用起来特别方便,例如:可是使用composer下载PHPMailer,think-captcha(验证码)等等…… 接下来说一下怎么使用 ...
- luke下载使用
网上内容太多,下载了却不管用,即使下载了,也不知道怎么用.(对我这种小白来说,大神就一笑而过吧) 下载地址:http://www.xdowns.com/app/253909.html(如若下载不到可以 ...
- Linux手动添加swap分区
转自:https://blog.csdn.net/whatday/article/details/51024571 为什么需要swap 根据Redhat公司的建议,Linux系统swap分区最适合的大 ...
- jmeter安装与环境变量配置
因jmeter是java开发的,要想运行java开发的程序,必须先下载JDK一.jdk 1.下载jdk jdk下载地址:https://www.oracle.com/technetwork/java ...
- 项目实战03:Keepalived 实现高可用
目录 实验一:实现keepalived主从方式高可用基于LVS-DR模式的应用实战: 1.环境准备: 2.在lvs-server-master 主上 3.在lvs-server-backup 从上 4 ...
- 【转】前端框架天下三分:Angular React 和 Vue的比较
前端框架天下三分:Angular React 和 Vue的比较 原文链接:http://blog.csdn.net/haoshidai/article/details/52346865 前端这几年的技 ...
- Django + Axios & Ajax post和get 传参
话说千遍淡如水,不如代码来一通. Axios post: let params = new URLSearchParams(); params.append('id',xx) axios({ ur ...
- 自己用纯C++实现简单的QT中信号与槽机制
前天在我很久以前的一篇博文 (http://blog.csdn.net/liukang325/article/details/45742675) 中有人回复说看到我的博文很激动,希望我详细介绍一下信号 ...
- jupyter notebook安装/代码补全/支持golang 踩坑记
安装(不要用root) 安装anaconda3,然后ln -s bin目录下的jupyter命令到/usr/bin目录下 生成密码备用 敲ipython进入交互终端 In [1]: from note ...
- tarjan代码
还有五天就是NOIP2018了……本蒟蒻还要复习期中考试,因此实在没有时间写博客了(各种找借口).这里就放一下代码 //Tarjan缩点 //题目描述:给一个有向图.每个点有一个权值,求权值和最大的路 ...