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...........的更多相关文章

  1. HDOJ.1800 Flying to the Mars(贪心+map)

    Flying to the Mars 点我挑战题目 题意分析 有n个人,每个人都有一定的等级,高等级的人可以教低等级的人骑扫帚,并且他们可以共用一个扫帚,问至少需要几个扫帚. 这道题与最少拦截系统有异 ...

  2. 杭电 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 ...

  3. hdu 1800 Flying to the Mars

    Flying to the Mars 题意:找出题给的最少的递增序列(严格递增)的个数,其中序列中每个数字不多于30位:序列长度不长于3000: input: 4 (n) 10 20 30 04 ou ...

  4. HDU 1800——Flying to the Mars——————【字符串哈希】

    Flying to the Mars Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  5. 【HDOJ】1800 Flying to the Mars

    1. 题目描述挺简单的一道题,给定$n$个大整数,求出现最多的次数. 2. 基本思路这题是可以使用哈希做,ELFHash等哈希都可以过. 3. 代码 /* 1800 */ #include <i ...

  6. --hdu 1800 Flying to the Mars(贪心)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1800 Ac code: #include<stdio.h> #include<std ...

  7. HDU - 1800 Flying to the Mars 【贪心】

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1800 题意 给出N个人的 level 然后 高的level 的 人 是可以携带 比他低level 的人 ...

  8. HDU 1800 Flying to the Mars 字典树,STL中的map ,哈希树

    http://acm.hdu.edu.cn/showproblem.php?pid=1800 字典树 #include<iostream> #include<string.h> ...

  9. HDU 1800 Flying to the Mars Trie或者hash

    http://acm.hdu.edu.cn/showproblem.php?pid=1800 题目大意: 又是废话连篇 给你一些由数字组成的字符串,判断去掉前导0后那个字符串出现频率最高. 一开始敲h ...

随机推荐

  1. Uva 10935 Throwing cards away I

    题目意思:有N张牌,标号为1~N,且牌以叠好,从上到小就是标号1-N的牌,只要牌堆数量大于等于2的时候,就采取如下操作:将最上面的牌扔掉(即离开牌堆).刚才那张牌离开后,再将新的最上面的牌放置于牌堆最 ...

  2. HDU 4569Special equations2012长沙邀请赛E题(数学知识)

    Special equations Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  3. uva - The Lottery(容斥,好题)

    10325 - The Lottery The Sports Association of Bangladesh is in great problem with their latest lotte ...

  4. iOS7支持九宫格

    Beta4支持九宫格 还没试,等最终版把,现在的有很多bug还比较费电 看网上有人说虽然终于出来了但是还是不如百度搜狗等输入法方便 前几个月在weiphone上还有人问支不支持结果回帖的都说没戏 这算 ...

  5. 【Eclipse】Tomcat 改变发布路径

    关闭服务,删除里面的所有项目,clean,然后双击服务,发布路径修改就可以点击了.当重新发布了项目后,发布路径修改的按钮又会恢复不可点击状态.

  6. [转] iOS (OC) 中 KVC 与 KVO 理解

    转自: http://magicalboy.com/kvc_and_kvo/ KVC 与 KVO 是 Objective C 的关键概念,个人认为必须理解的东西,下面是实例讲解. Key-Value ...

  7. Qt中所有类型之间的转换

    1.char * 与 const char *的转换 char *ch1="hello11";const char *ch2="hello22";ch2 = c ...

  8. linux mount挂载设备(u盘,光盘,iso等 )使用说明

    对于新手学习,mount 命令,一定会有很多疑问.其实我想疑问来源更多的是对linux系统本身特殊性了解问题. linux是基于文件系统,所有的设备都会对应于:/dev/下面的设备.如: [cheng ...

  9. zoj 2277 The Gate to Freedom

    N^N = X --->    Nlog10(N) = log10( X ) ---->    X的最高位为 Nlog10(N) 小数部分的第一个非0位 #include<stdio ...

  10. hdu1397(素数组和成偶数的个数 用 标记法)

    Problem Description Goldbach's Conjecture: For any even number n greater than or equal to 4, there e ...