--hdu 1800 Flying to the Mars(贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1800
Ac code:
#include<stdio.h>
#include<stdlib.h>
int cmp(const void *a,const void *b)
{
return *(int *)a-*(int *)b;
}
int main(void)
{
int n,i,ma,t;
int a[3005];
while(scanf("%d",&n)!=EOF)
{
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
qsort(a,n,sizeof(a[0]),cmp);
ma=1;t=1;
for(i=1;i<n;++i)
{
if(a[i]!=a[i-1])
t=1;
else
++t;
ma=t>ma?t:ma;
}
printf("%d\n",ma);
} return 0;
}
--hdu 1800 Flying to the Mars(贪心)的更多相关文章
- hdu 1800 Flying to the Mars
Flying to the Mars 题意:找出题给的最少的递增序列(严格递增)的个数,其中序列中每个数字不多于30位:序列长度不长于3000: input: 4 (n) 10 20 30 04 ou ...
- HDU 1800——Flying to the Mars——————【字符串哈希】
Flying to the Mars Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Other ...
- HDU - 1800 Flying to the Mars 【贪心】
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1800 题意 给出N个人的 level 然后 高的level 的 人 是可以携带 比他低level 的人 ...
- HDU 1800 Flying to the Mars 字典树,STL中的map ,哈希树
http://acm.hdu.edu.cn/showproblem.php?pid=1800 字典树 #include<iostream> #include<string.h> ...
- HDU 1800 Flying to the Mars Trie或者hash
http://acm.hdu.edu.cn/showproblem.php?pid=1800 题目大意: 又是废话连篇 给你一些由数字组成的字符串,判断去掉前导0后那个字符串出现频率最高. 一开始敲h ...
- hdu 1800 Flying to the Mars(简单模拟,string,字符串)
题目 又来了string的基本用法 //less than 30 digits //等级长度甚至是超过了int64,所以要用字符串来模拟,然后注意去掉前导零 //最多重复的个数就是答案 //关于str ...
- 杭电 1800 Flying to the Mars(贪心)
http://acm.hdu.edu.cn/showproblem.php?pid=1800 Flying to the Mars Time Limit: 5000/1000 MS (Java/Oth ...
- HDOJ.1800 Flying to the Mars(贪心+map)
Flying to the Mars 点我挑战题目 题意分析 有n个人,每个人都有一定的等级,高等级的人可以教低等级的人骑扫帚,并且他们可以共用一个扫帚,问至少需要几个扫帚. 这道题与最少拦截系统有异 ...
- HDOJ 1800 Flying to the Mars 盲目搜索......................so easy...........
check the original problem here:http://acm.hdu.edu.cn/showproblem.php?pid=1800 the AC code: #include ...
随机推荐
- MySQL server has gone away的解决方法
用Python写了一个http服务,需要从mysql读数据库,第一天还好好的,第二天突然不行了.报错如下: pymysql.err.OperationalError: (2006, 'MySQL se ...
- 从0开始学Java——从jsp到servlet转换的各种辅助元素介绍
1. 指示元素,<%@指示元素 [属性=值]* %> 其中指示元素包括page, include, 和tablib三个. 其中 属性=值 可以有多对. 其中page用来告知容器如何转译目 ...
- [CareerCup] 9.4 Subsets 子集合
9.4 Write a method to return all subsets of a set. LeetCode上的原题,请参见我之前的博客Subsets 子集合和Subsets II 子集合之 ...
- 地图坐标转换 -- 火星坐标与GPS坐标
第一次处理地理位置的数据的人,没什么经验,往往掉入很多坑浪费不少时间.我也是刚刚从坑里爬出来.这篇博文主要是把入门GPS轨迹分析的经验总结一下,以方便大家少走些弯路. (1)可视化 GPS 路径 刚拿 ...
- 34 Sources for Test Ideas
We recommend collecting test ideas continuously from a variety of information sources. Consider the ...
- dll,lib文件的导入
这里介绍了两种方式调用,不过我一般用的是第一种,比较方便. 1动态库函数的调用,可以采用静态链接的方式 ,主要步骤如下: 1) 包含DLL中导出的头文件. 2) 采用#pragma comment(l ...
- 如何部署Iveely.Computing分布式实时计算系统
Iveely.Computing是参考Storm的分布式实时计算系统的部分原理,用纯Java实现的轻量级.迷你型,适合于搜索引擎的实时计算系统, Iveely 搜索引擎是一款基于Iveely.Comp ...
- android之imgView插件的使用
在开发中我们经常要用到图片下载功能,但我们可以在github上淘一些比较好的插件,这里介绍一款叫smartImageView的插件. 这里是其地址https://github.com/loopj/an ...
- C语言总结(6)
1.表达式: 算数表达式: 单目:+, -, ++, --. 双目:+,-,*,/,%. 赋值表达式: 简单赋值:= 复合赋值:+=,-=,*=,,/=%=,!=. 关系表达式: >,>= ...
- Beta版本冲刺计划
1.下一阶段需要改进完善的功能 文件读取 界面 人员批量增改 数据库 ... 2.下一阶段新增的功能 人员权限分离分化. 课表导出 ... 3.需要改进的团队分工(针对之前的不足,需要加强和改进团队协 ...