【CodeForces 471A】MUH and Sticks
题意
给你六根木棍的长度,熊需要头比身体短,大象需要头和身体一样,四肢要一样长,否则就是外星人。请你判断能组成哪一个。
分析
暴力,循环看一下每根有几根相同的,然后如果有四根都是有四根相同的&&有两根是有两根相同的||有六根是有六根相同的,那就是大象,如果出现有五根相同的,或者不满足上面大象的条件,但是有四根四根相同,那就是熊,其它情况就是外星人。当时是另一种做法。感觉现在的做法思路更简单。
代码
#include<stdio.h>
#include<algorithm>
using namespace std;
int sticks[],num[];
int main()
{
for(int i=; i<=; i++)
scanf("%d",&sticks[i]);
for(int i=; i<=; i++)
{
int same=;
for(int j=; j<=; j++)
{
if (sticks[i] == sticks[j])
same++;
}
num[same]++;
}
if (num[]== && num[]== || num[]== ) printf("Elephant\n");
else if (num[]== || num[]==) printf("Bear\n");
else printf("Alien\n");
return ;
}
【CodeForces 471A】MUH and Sticks的更多相关文章
- 【Codeforces 258A】 Game With Sticks
[题目链接] http://codeforces.com/contest/451/problem/A [算法] 若n和m中的最小值是奇数,则先手胜,否则后手胜 [代码] #include<bit ...
- 【codeforces 415D】Mashmokh and ACM(普通dp)
[codeforces 415D]Mashmokh and ACM 题意:美丽数列定义:对于数列中的每一个i都满足:arr[i+1]%arr[i]==0 输入n,k(1<=n,k<=200 ...
- 【codeforces 757A】Gotta Catch Em' All!
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【codeforces 707E】Garlands
[题目链接]:http://codeforces.com/contest/707/problem/E [题意] 给你一个n*m的方阵; 里面有k个联通块; 这k个联通块,每个连通块里面都是灯; 给你q ...
- 【codeforces 707C】Pythagorean Triples
[题目链接]:http://codeforces.com/contest/707/problem/C [题意] 给你一个数字n; 问你这个数字是不是某个三角形的一条边; 如果是让你输出另外两条边的大小 ...
- 【codeforces 709D】Recover the String
[题目链接]:http://codeforces.com/problemset/problem/709/D [题意] 给你一个序列; 给出01子列和10子列和00子列以及11子列的个数; 然后让你输出 ...
- 【codeforces 709B】Checkpoints
[题目链接]:http://codeforces.com/contest/709/problem/B [题意] 让你从起点开始走过n-1个点(至少n-1个) 问你最少走多远; [题解] 肯定不多走啊; ...
- 【codeforces 709C】Letters Cyclic Shift
[题目链接]:http://codeforces.com/contest/709/problem/C [题意] 让你改变一个字符串的子集(连续的一段); ->这一段的每个字符的字母都变成之前的一 ...
- 【Codeforces 429D】 Tricky Function
[题目链接] http://codeforces.com/problemset/problem/429/D [算法] 令Si = A1 + A2 + ... + Ai(A的前缀和) 则g(i,j) = ...
随机推荐
- codeforces 719E E. Sasha and Array(线段树)
题目链接: E. Sasha and Array time limit per test 5 seconds memory limit per test 256 megabytes input sta ...
- Mango DS Traning #49 ---线段树3 解题手记
Training address: http://acm.hust.edu.cn/vjudge/contest/view.action?cid=38994#overview B.Xenia and B ...
- Android外部SD卡的读取
package com.kevin.writeorreadfile1_1; import android.app.Activity; import android.bluetooth.le.ScanF ...
- HTML5和css3的总结三
继续总结H5的新东西 1>序列化与反序列化 序列化:其实就是一个json->string的过程 JSON.stringify(json); 反序列化:string->json的过程( ...
- 关联:objc_getAssociatedObject和objc_setAssociatedObject使用
为UIButton的category添加属性 UIButton+subTitle.h #import <UIKit/UIKit.h> #import <objc/runtime.h& ...
- 一、IOS运行原理
1.首先执行main函数 2.执行UIPaalicationMain函数 3.UIApplication函数内部 1>创建一个UIApplication实例.这个UIApplication对象是 ...
- 【C#】【Thread】上下文同步域SynchronizationAttribute
上下文同步:使用SynchronizationAttribute为ContextBoundObject对象创建一个简单的自动的同步. 这种同步方式仅用于实例化的方法和域的同步.所有在同一个上下文域的对 ...
- 分享JS代码(转)
var imgUrl = 'http://xxx/share_ico.png'; // 分享后展示的一张图片 var lineLink = 'http://xxx'; // 点击分享后跳转的页面地址 ...
- nginx log的json格式:
nginx log的json格式: 为了elk便于统计: yum安装nginx: log_format json '{"@timestamp": "$time_iso86 ...
- How to install 64-bit Google Chrome 28+ on 64-bit RHEL/CentOS 6 or 7
How to install 64-bit Google Chrome 28+ on 64-bit RHEL/CentOS 6 or 7 The problem Google developers s ...