hdu 2192 MagicBuilding
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2418 Accepted Submission(s):
1088
people is becoming smaller and smaller. In MagicStar the problem is much worse.
Dr. Mathematica is trying to save land by clustering buildings and then we call
the set of buildings MagicBuilding. Now we can treat the buildings as a square
of size d, and the height doesn't matter. Buildings of d1,d2,d3....dn can be
clustered into one MagicBuilding if they satisfy di != dj(i != j).
Given a
series of buildings size , you need to calculate the minimal numbers of
MagicBuildings that can be made. Note that one building can also be considered
as a MagicBuilding.
Suppose there are five buildings : 1, 2, 2, 3, 3. We make
three MagicBuildings (1,3), (2,3), (2) .And we can also make two MagicBuilding
:(1,2,3), (2,3). There is at least two MagicBuildings obviously.
indicating the number of test cases.
Each test case starts by n (1≤n≤10^4) in
a line indicating the number of buildings. Next n positive numbers (less than
2^31) will be the size of the buildings.
the minimal number of the MagicBuilding that can be made.
1
2
5
1 2 2 3 3
2
#include <algorithm>
#include <cstdio> using namespace std;
int maxn,ans,t,n,buil[];
int main()
{
scanf("%d",&t);
for(;t--;)
{
maxn=ans=;
scanf("%d",&n);
for(int i=;i<=n;i++)
scanf("%d",&buil[i]);
sort(buil+,buil++n);
for(int i=;i<=n;i++)
{
if(buil[i]==buil[i-])
ans++;
else
{
if(ans>maxn) maxn=ans;
ans=;
}
}
if(ans>maxn) maxn=ans;
printf("%d\n",maxn);
}
return ;
}
hdu 2192 MagicBuilding的更多相关文章
- HDOJ(HDU) 2192 MagicBuilding(用Java的Map做了下)
Problem Description As the increase of population, the living space for people is becoming smaller a ...
- HDU 1501 & POJ 2192 Zipper(dp记忆化搜索)
题意:给定三个串,问c串是否能由a,b串任意组合在一起组成,但注意a,b串任意组合需要保证a,b原串的顺序 例如ab,cd可组成acbd,但不能组成adcb. 分析:对字符串上的dp还是不敏感啊,虽然 ...
- HDU——PKU题目分类
HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...
- [转] HDU 题目分类
转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...
- HDU ACM 题目分类
模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...
- HDU 5643 King's Game 打表
King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...
- 转载:hdu 题目分类 (侵删)
转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...
- 华农oj 2192: hzk又在打人【CRT合并/待补】
2192: hzk又在打人 Time Limit: 12 Sec Memory Limit: 512 MB Submit: 52 Solved: 1 [Submit][Status][Web Boar ...
- poj和hdu部分基础算法分类及难度排序
最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...
随机推荐
- 调节音量的各个方法——AudioManager的使用
AudioManager类位于android.Media包中,该类提供访问控制音量和铃声模式的操作. //获取AudioManager实例对象 AudioManager audioManage = ( ...
- js获取form的方法
先来看下面代码: ? <html> <head> <scirpy> window.onload=function(){ var f1=document.f1; ...
- 「LuoguP1496」 火烧赤壁
Description 曹操平定北方以后,公元208年,率领大军南下,进攻刘表.他的人马还没有到荆州,刘表已经病死.他的儿子刘琮听到曹军声势浩大,吓破了胆,先派人求降了. 孙权任命周瑜为都督,拨给他三 ...
- Android开发中几种有用的的日历控件实现
我们大家都知道,在Android平台3.0中才新增了日历视图控件,可以显示网格状的日历内容,那么对于3.0以下的版本要使用日历控件只能借助第三方,目前用的最多的是CalendarView. 先简单介绍 ...
- Linux的终端类型
终端是一个很重要的外设,用过终端设备的人都知道如果设备类型不对就会有乱字符,也可用仿真终端软件如netterm试验一下,Linux的终端信息放在 /usr/share/terminfo下,在这个目录的 ...
- Java泛型简明教程
泛型是Java SE 5.0中引入的一项特征,自从这项语言特征出现多年来,我相信,几乎所有的Java程序员不仅听说过,而且使用过它.关于Java泛型的教程,免费的,不免费的,有很多.我遇到的最好的教材 ...
- 13_android实现多线程下载_界面实现
进度条这个东西可以给它创建一个布局.进度条叫ProgressBar. ProgressBar这个就是进度条. 默认的安卓进度条是一个圈圈,一圈一圈转. 之前咱们把一个XML文件转化成一个View对象, ...
- View Programming Guide for iOS ---- iOS 视图编程指南(二)---View and Window Architecture
View and Window Architecture 视图和窗口架构 Views and windows present your application’s user interface and ...
- NYOJ6——喷水装置(一)
喷水装置(一) 时间限制:3000 ms | 内存限制:65535 KB 难度:3 描述:现有一块草坪,长为20米,宽为2米,要在横中心线上放置半径为Ri的喷水装置,每个喷水装置的效果都会让以它 ...
- JDK8 Lamdba表达式转换成Map,value为null问题
// 将list转换成Map类型 Map<String, String> map = list.stream().collect(Collectors.toMap(Person::getI ...