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的一些题目 ...
随机推荐
- Linux Cache 机制
在阅读文章前,您应该具备基本的存储器层次结构知识,至少要了解局部性原理.要详细了解cache基本原理,可以参考本书<深入理解计算机系统>中存储器体系结构一章: 带着疑问来看文章,cache ...
- JNI(Java Native Interface)
一.JNI(Java Native Interface) 1.什么是JNI: JNI(Java Native Interface):java本地开发接口 ...
- 6-10 SVM支持向量机1
都是特征加上分类器.还将为大家介绍如何对这个数据进行训练.如何训练得到这样一组数据. 其实SVM支持向量机,它的本质仍然是一个分类器.既然是一个分类器,它就具有分类的功能.我们可以使用一条直线来完成分 ...
- 高效使用ppt素材
一.素材大致分为: 立体素材:以TG素材为代表的那种高光立体素材 平面素材:以咨询公司麦肯锡.罗兰贝格公司为代表的平面设计的素材 二.使用原则: 原则一:平面左边,立体右边 这个原则告诉你几件事: 如 ...
- 用Xtrabackup实现MySQL全库备份与恢复
xtrabackup包含两个主要的工具,即xtrabackup和innobackupex,二者区别如下: (1)xtrabackup只能备份innodb和xtradb两种引擎的表,而不能备份myisa ...
- Playground Tutorial
In this step by step tutorial we'll walk through setting up a business network, defining our assets, ...
- hdoj3183【思维】
思路: 处理方案非常霸气啊,无奈想不到. 说是n位去m个,那么默认就是取了n-m个数字,ok,然后m #include <iostream> #include <stdio.h> ...
- spark 机器学习 朴素贝叶斯 原理(一)
朴素贝叶斯算法仍然是流行的挖掘算法之一,该算法是有监督的学习算法,解决的是分类问题,如客户是否流失.是否值得投资.信用等级评定等多分类问题.该算法的优点在于简单易懂.学习效率高.在某些领域的分类问题中 ...
- macOS 设置Root密码
用管理员帐号进入Terminal: 1) 输入:sudo passwd root ,回车: 2) 输入新的root密码: 3) 输入:su : 4) 输入新密码: 这样就进入到root帐号了.
- 远程报:这可能是由于credssp加密oracle修正
此错误解决办法 1.Win+R 输入regedit打开注册表 找到对应的以下目录HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion ...