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<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<map>
#include<cstdio>
using namespace std;
int level[3010];
bool visit[3010];
bool cmp(int a,int b){
return a>b;
}
int main()
{
int n;
while(cin>>n)
{
for(int i=0;i<n;i++)
scanf("%d",&level[i]);
memset(visit,0,sizeof(visit));
sort(level,level+n,cmp);
int sum=0;
for(int i=0;i<n;i++)
{
if(visit[i])continue;
int k=i;
for(int j=0;j<n;j++)
{
if(visit[j])continue;
if(level[j]<level[k]){
visit[j]=1;
k=j;
}
}
sum++;
visit[i]=1;
}
cout<<sum<<endl;
}
return 0;
}
HDOJ 1800 Flying to the Mars 盲目搜索......................so easy...........的更多相关文章
- HDOJ.1800 Flying to the Mars(贪心+map)
Flying to the Mars 点我挑战题目 题意分析 有n个人,每个人都有一定的等级,高等级的人可以教低等级的人骑扫帚,并且他们可以共用一个扫帚,问至少需要几个扫帚. 这道题与最少拦截系统有异 ...
- 杭电 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 ...
- 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 ...
- 【HDOJ】1800 Flying to the Mars
1. 题目描述挺简单的一道题,给定$n$个大整数,求出现最多的次数. 2. 基本思路这题是可以使用哈希做,ELFHash等哈希都可以过. 3. 代码 /* 1800 */ #include <i ...
- --hdu 1800 Flying to the Mars(贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1800 Ac code: #include<stdio.h> #include<std ...
- 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 ...
随机推荐
- perl学习(2) 基本数据类型等
1.1.数字 所有数字格式内部一致,全部是double 7.25e45 == 7.25 * 1045 5.25 6.00 5.1-2.4 #5.1-2.4,2.7 10/3 ...
- HDFS写入和读取流程
HDFS写入和读取流程 一.HDFS HDFS全称是Hadoop Distributed System.HDFS是为以流的方式存取大文件而设计的.适用于几百MB,GB以及TB,并写一次读多次的场合.而 ...
- 基于visual Studio2013解决C语言竞赛题之0407最大值最小值
题目 解决代码及点评 这道题考察循环和比较 /*********************************************************************** ...
- MFC技术内幕系列之(四)---MFC消息映射与消息传递内幕
//////////////////////////////////////////////////////////////////////////////////// ...
- AVOS Cloud Hackathon - SegmentFault
AVOS Cloud Hackathon - SegmentFault AVOS Cloud Hackathon
- wchar_t*和char*之间的互相转换的那些事
最近在看一写PE文件格式的东西,想做一个读取PE文件信息的小工具,中间遇到将LPVOID格式无法转换到LPTSTR格式,强制转换屡试屡败,多显示乱码.我们知道LPVOID格式可以直接转换到char * ...
- Block动画 和 Spring动画
Block动画: @interface BlockViewController () @property (weak, nonatomic) IBOutlet UIView *playView; @e ...
- 九度 和为S的连续正数序列
题目1354:和为S的连续正数序列 时间限制:2 秒 内存限制:32 兆 特殊判题:否 提交:2008 解决:622 题目描述: 小明很喜欢数学,有一天他在做数学作业时,要求计算出9~16的和,他马上 ...
- 企业级IM应该帮助员工提高绩效,避免无关的信息干扰
很多上班族一定熟悉如下的场景: 您早上上班一打开QQ,就弹出一个新闻集成窗口,随便点开看看吧,这一点不要紧,您就被一个又一个的链接带着逛下去了.等回过神来要工作的时候,发现已经在这些八卦新闻上浪费了一 ...
- hdu4513之manacher算法
吉哥系列故事——完美队形II Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) T ...