Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2418    Accepted Submission(s):
1088

Problem Description
As the increase of population, the living space for
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.
 
Input
The first line of the input is a single number t,
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.
 
Output
For each test case , output a number perline, meaning
the minimal number of the MagicBuilding that can be made.
 
Sample Input
2
1
2
5
1 2 2 3 3
 
Sample Output
1
2
 
Author
scnu
 
Recommend
 
题目大意 :
高度不同的可以合并为一个楼,问最少能合并成多少楼
简单模拟 
#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的更多相关文章

  1. HDOJ(HDU) 2192 MagicBuilding(用Java的Map做了下)

    Problem Description As the increase of population, the living space for people is becoming smaller a ...

  2. HDU 1501 & POJ 2192 Zipper(dp记忆化搜索)

    题意:给定三个串,问c串是否能由a,b串任意组合在一起组成,但注意a,b串任意组合需要保证a,b原串的顺序 例如ab,cd可组成acbd,但不能组成adcb. 分析:对字符串上的dp还是不敏感啊,虽然 ...

  3. HDU——PKU题目分类

    HDU 模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 ...

  4. [转] HDU 题目分类

    转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...

  5. HDU ACM 题目分类

    模拟题, 枚举1002 1004 1013 1015 1017 1020 1022 1029 1031 1033 1034 1035 1036 1037 1039 1042 1047 1048 104 ...

  6. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  7. 转载:hdu 题目分类 (侵删)

    转载:from http://blog.csdn.net/qq_28236309/article/details/47818349 基础题:1000.1001.1004.1005.1008.1012. ...

  8. 华农oj 2192: hzk又在打人【CRT合并/待补】

    2192: hzk又在打人 Time Limit: 12 Sec Memory Limit: 512 MB Submit: 52 Solved: 1 [Submit][Status][Web Boar ...

  9. poj和hdu部分基础算法分类及难度排序

    最近想从头开始刷点基础些的题,正好有个网站有关于各大oj的题目分类(http://www.pythontip.com/acm/problemCategory),所以写了点脚本把hdu和poj的一些题目 ...

随机推荐

  1. ES6 模板编译

    顾名思义,就是用反引号编写一个模板字符串, 用echo将模板转为javascrip表达式字符串, 用正则将基础字符串转为想要字符串 将代码封装在函数中返回: 注: 用到es6属性${} var tem ...

  2. Cocos2d-X对常用Object-C特性的替换

    平台的转换,总是让我们不自觉的去寻找两者的相同处,不过Cocos2d-X的确对很多Object-C的特性进行了模仿性质的封装,使熟悉Object-C的人能够在其中看到很多类似的概念而感到亲切.     ...

  3. 《SONG FROM PI: A MUSICALLY PLAUSIBLE NETWORK FOR POP MUSIC GENERATION》论文笔记

    出处:ICLR 2017 Motivation 提出一个通用的基于RNN的pop music生成模型,在层次结构中封装了先验乐理知识(prior knowledge about how pop mus ...

  4. C - Soldier and Cards

    Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description Two bo ...

  5. File System Programming---(三)

    Accessing Files and Directories Before you can open a file, you first have to locate it in the file ...

  6. (水题)洛谷 - P1003 - 铺地毯

    https://www.luogu.org/problemnew/show/P1003 一开始觉得是用树套树来区间修改单点查询,但是发现空间不够开. 看了题解发现这个是静态的问题,而且只问一个点的结果 ...

  7. IT兄弟连 JavaWeb教程 Servlet API

    Java Servlet是运行在带有支持Java Servlet规范的解释器的web服务器上的Java类. Servlet可以使用javax.servlet和javax.servlet.http包创建 ...

  8. .NET CORE之API日志收集

    我们在构建WEBAPI项目时,通常需要构建一个全局的记录API 请求和返回 的功能,在WEBAPI框架下 我们通过自定义一个DelegateHandler来实现这个功能, 在.NET CORE框架下已 ...

  9. iOS 上传的图片在HTML上显示时,图片方向信息(EXIF Orientation)异常

    将iPhone 6s拍摄的照片上传到服务器之后, 在Web网页上看到图片被逆时针旋转了90度, 这让我很惆怅呐! 出现这个问题其实是因为上传的图片为.jpg格式,.jpg文件含有EXIF信息, 其中E ...

  10. sql mysql和sqlserver存在就更新,不存在就插入的写法(转)

    转自:http://hi.baidu.com/tidy0608/item/ff930fe2436f2601560f1dd9 sqlsever数据存在就更新,不存在就插入的两种方法 两种经常使用的方法: ...