题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5038

解题报告:就是输入n个数w,定义s = 10000 - (100 - w)^2,问s出现频率最高的是哪些,当所有的不同的s出现频率相同时,输出Bad Mushroom,当s只有一种时,直接输出。

 #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn = ; int num[maxn+],ans[maxn+];
int main()
{
int T,n,kase = ;
scanf("%d",&T);
while(T--)
{
scanf("%d",&n);
memset(num,,sizeof(num));
memset(ans,,sizeof(ans));
int w ,t,M = ;
for(int i = ;i < n;++i)
{
scanf("%d",&w);
t = - ( - w) * ( - w);
num[t]++;
M = max(M,num[t]);
}
int f = ,tot = ,tt = ;
for(int i = ;i <= ;++i)
if(num[i] == M)
{
ans[f++] = i;
tot++;
tt += num[i];
}
sort(ans,ans+f);
printf("Case #%d:\n",kase++);
if(tot != && tt == n)
{
puts("Bad Mushroom");
continue;
}
for(int i = ;i < f;++i)
printf(i == f - ? "%d\n":"%d ",ans[i]);
}
return ;
}

HDU 5038 Grade北京赛区网赛1005的更多相关文章

  1. hdu 4044 2011北京赛区网络赛E 树形dp ****

    专题训练 #include<stdio.h> #include<iostream> #include<string.h> #include<algorithm ...

  2. hdu 4050 2011北京赛区网络赛K 概率dp ***

    题目:给出1-n连续的方格,从0开始,每一个格子有4个状态,左右脚交替,向右跳,而且每一步的步长必须在给定的区间之内.当跳出n个格子或者没有格子可以跳的时候就结束了,求出游戏的期望步数 0:表示不能到 ...

  3. hdu 4049 2011北京赛区网络赛J 状压dp ***

    cl少用在for循环里 #include<cstdio> #include<iostream> #include<algorithm> #include<cs ...

  4. hdu 4045 2011北京赛区网络赛F 组合数+斯特林数 ***

    插板法基础知识 斯特林数见百科 #include<iostream> #include<cmath> #include<cstdio> #include<cs ...

  5. hdu 4043 2011北京赛区网络赛D 概率+大数 **

    推出公式为:P = A(2n,n)/(2^(2n)*n!) 但是不会大数,学完java再补

  6. hdu 4041 2011北京赛区网络赛B 搜索 ***

    直接在字符串上搜索,注意逗号的处理 #include<cstdio> #include<iostream> #include<algorithm> #include ...

  7. hdu 4046 2011北京赛区网络赛G 线段树 ***

    还带这么做的,卧槽,15分钟就被A了的题,居然没搞出来 若某位是1,则前两个为wb,这位就是w #include<cstdio> #include<cstring> #defi ...

  8. HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011亚洲北京赛区网络赛)

    HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011 亚洲北京赛区网络赛题目) Eliminate Witches! Time Limit: 2000/1000 ...

  9. HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛)

    HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛) Panda Time Limit: 10000/4000 MS (Java/Others)    Memory Limit: ...

随机推荐

  1. Linux Basis --- commands of vi

    EDIT mode to GENERAL mode: press ESC general mode: CLOSE FILE :q!    :force to close the file but no ...

  2. CentOS设置默认启动命令行(不启动图形界面)

    Linux 启动的时候可以选择纯文本或者是窗口环境,这就牵涉了运行等级这个问题.Linux 默认提供了 7 个 Run level 给我们使用,其中我们最常用的就是 run level3 和run l ...

  3. nosql理解

    1.NoSQL是什么? NoSQL 是 Not Only SQL 的缩写,意即"不仅仅是SQL"的意思,泛指非关系型的数据库.强调Key-Value Stores和文档数据库的优点 ...

  4. Python目录操作

    Python目录操作 os和os.path模块os.listdir(dirname):列出dirname下的目录和文件os.getcwd():获得当前工作目录os.curdir:返回但前目录('.') ...

  5. yum提示another app is currently holding the yum lock;waiting for it to exit

    Another app 解决方法:rm -rf /var/run/yum.pid 来强行解除锁定,然后你的yum就可以运行了

  6. 9月6日表格标签(table、行、列、表头)(补)

    一.<table> <table>代表表格标签.   <table></table> 1.width  表示表格宽度,宽度表达方式有像素和百分比两种.网 ...

  7. JavaWeb学习笔记——jsp基础语法

    1.JSP注释 显式注释 <!-- 注释内容 --> 隐式注释,隐式注释在客户端无法看见 // /* */ <% 注释内容 %> 2.Scriptlet(小脚本程序) 所有嵌入 ...

  8. LaTex 使用 - 配置

    Reference Link: http://www.howtotex.com/howto/installing-latex-on-windows/ MikTeX:http://miktex.org/ ...

  9. sublime中安装css 格式化插件

    HTML-CSS-JS Prettify解决问题 今天发现此插件依赖于nodejs,如果本机没有安装nodejs,会一直提示你安装,解决方法很简单,直接brew install nodejs即可 看看 ...

  10. adapter(转自Devin Zhang)

    1.概念 Adapter是连接后端数据和前端显示的适配器接口,是数据和UI(View)之间一个重要的纽带.在常见的View(ListView,GridView)等地方都需要用到Adapter.如下图直 ...