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. Codeforces-707D:Persistent Bookcase (离线处理特殊的可持久化问题&&Bitset)

    Recently in school Alina has learned what are the persistent data structures: they are data structur ...

  2. margin---bug

    常见的浏览器下margin出现的bug IE6中双边距Bug:发生场合:当给父元素内第一个浮动元素设置margin-left(元素float:left)或margin-right(元素float:ri ...

  3. vs 发布网站的时候不编译

    vs2010 vs2008

  4. E20180403-hm

    accompany vt. 陪伴,陪同; 附加,补充; 与…共存; 为…伴奏 synchronous adj. 同时存在[发生]的,同步的 asynchronous adj. 异步的; particu ...

  5. Codeforces - 1033C - Permutation Game - 简单dp - 简单数论

    https://codeforces.com/problemset/problem/1033/C 一开始觉得自己的答案会TLE,但是吸取徐州赛区的经验去莽了一发. 其实因为下面这个公式是 $O(nlo ...

  6. loj #6302. 「CodePlus 2018 3 月赛」寻找车位【线段树+单调队列】

    考虑静态怎么做:枚举右边界,然后枚举上边界,对应的下边界一定单调不降,单调栈维护每一列从当前枚举的右边界向左最长空位的长度,这样是O(nm)的 注意到n>=m,所以m<=2000,可以枚举 ...

  7. 密码(Password)

    #include<cstdio> #include<cstring> using namespace std; int k, cnt; ][][], ans[]; bool d ...

  8. Hexo瞎折腾系列(3) - 添加GitHub彩带和GitHub Corner

    页面右上角添加GitHub彩带 你可以在这里找到一共12种样式的GitHub彩带,复制其中的超链代码. 在themes\next\layout\_layout.swig目录下找到头部彩带相关的代码: ...

  9. Python 教程资源

    1.廖雪峰的官方网站 http://www.liaoxuefeng.com/wiki/001374738125095c955c1e6d8bb493182103fac9270762a000/001386 ...

  10. bzoj1854 [Scoi2010]游戏【构图 并查集】

    传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1854 没想到怎么做真是不应该,看到每个武器都有两个属性,应该要想到连边构图的!太不应该了! ...