HDU 5038 Grade北京赛区网赛1005
题目链接: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的更多相关文章
- hdu 4044 2011北京赛区网络赛E 树形dp ****
专题训练 #include<stdio.h> #include<iostream> #include<string.h> #include<algorithm ...
- hdu 4050 2011北京赛区网络赛K 概率dp ***
题目:给出1-n连续的方格,从0开始,每一个格子有4个状态,左右脚交替,向右跳,而且每一步的步长必须在给定的区间之内.当跳出n个格子或者没有格子可以跳的时候就结束了,求出游戏的期望步数 0:表示不能到 ...
- hdu 4049 2011北京赛区网络赛J 状压dp ***
cl少用在for循环里 #include<cstdio> #include<iostream> #include<algorithm> #include<cs ...
- hdu 4045 2011北京赛区网络赛F 组合数+斯特林数 ***
插板法基础知识 斯特林数见百科 #include<iostream> #include<cmath> #include<cstdio> #include<cs ...
- hdu 4043 2011北京赛区网络赛D 概率+大数 **
推出公式为:P = A(2n,n)/(2^(2n)*n!) 但是不会大数,学完java再补
- hdu 4041 2011北京赛区网络赛B 搜索 ***
直接在字符串上搜索,注意逗号的处理 #include<cstdio> #include<iostream> #include<algorithm> #include ...
- hdu 4046 2011北京赛区网络赛G 线段树 ***
还带这么做的,卧槽,15分钟就被A了的题,居然没搞出来 若某位是1,则前两个为wb,这位就是w #include<cstdio> #include<cstring> #defi ...
- HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011亚洲北京赛区网络赛)
HDU 4041 Eliminate Witches! (模拟题 ACM ICPC 2011 亚洲北京赛区网络赛题目) Eliminate Witches! Time Limit: 2000/1000 ...
- HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛)
HDU 4046 Panda (ACM ICPC 2011北京赛区网络赛) Panda Time Limit: 10000/4000 MS (Java/Others) Memory Limit: ...
随机推荐
- python 处理CSV数据
从CS中导入数据 Python中有一个CSV模块支持读写各种方言格式的CSV文件.方言是很重要的,因为没有一个同意的CSV标准,不同的应用实现CSV的方式略有不同,当看到文件的内容的时候你往往很容易第 ...
- eclipse的一些常见操作
调整字体大小:Window-Preferences-General-Appearance-Colors and Fonts-Basic-Text Font
- 记录s标签范例
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding= ...
- js随笔,css和js禁止网页选择文本,table的class样式使得td的class样式失效,jquery获得元素坐标
css使用user-select,user-select不是W3C标准,浏览器支持不完整:user-select有两个值,none用户不可以选择文本,text用户可以选择文本 body{-moz-us ...
- Linux下开发常用 模拟 Http get和post请求
1.get请求 curl "http://www.baidu.com" 如果这里的URL指向的是一个文件或者一幅图都可以直接下载到本地 curl -i "htt ...
- GLEW OpenGL Access violation when using glGenVertexArrays
http://stackoverflow.com/questions/20766864/glew-opengl-access-violation-when-using-glgenvertexarray ...
- Win7系统中提示:本地无法启动MySQL服务,报的错误:1067,进程意外终止的解决方法。
Win7系统中提示:本地无法启动MySQL服务,报的错误:1067,进程意外终止的解决方法. 在本地计算机无法启动MYSQL服务错误1067进程意外终止.这种情况一般是my.ini文件配置出错了1.首 ...
- ] 解决myeclipse中新建javaweb工程,无法使用Web App Libraries问题
] 解决myeclipse中新建javaweb工程,无法使用Web App Libraries问题 标签: myeclipsejavawebWeb App Libraries 2013-10-16 1 ...
- Unity中各个平台的预编译的运用方式
1,unity中官方文档的一个操纵关键词 Platform Dependent Compilation 2,常用的预编译关键词 UNITY_EDITOR 编辑器调用.UNITY_STA ...
- CSV文件的读取 导出
CSV文件是 逗号分隔值文件 内容基本是这么存的... 姓名,年龄,性别/r/n王有才,,男/r/n王二妞,,女 一行值内用逗号 , 分开 行与行之间用 /r/n 分隔 说白了,他其实是一个字符 ...