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. java面板设计

    写面板真的是写到吐血,深深感受到什么叫又臭又长,可能是自己用的太烂吧. 关于布局管理器不写一下还是不懂,另外加面板的思想跟html中div的感觉差不多. 发现的一个小彩蛋:用JScrollPane的时 ...

  2. Putty远程登录VMware虚拟机Linux(Ubuntu12.04)

    为了不至于来回在Win7和Ubuntu12.04之间来回切换,在Win7下使用VMware9.0安装了Ubuntu12.04. 首先下载Vmware9.0虚拟机软件,下载地址为:VMware-work ...

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

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

  4. Unity KillCount

    using UnityEngine; using System.Collections; public class KillCountMult : MonoBehaviour { public GUI ...

  5. linux内核代码container_of

    它的作用显而易见,那就是根据一个结构体变量中的一个域成员变量的指针来获取指向整个结构体变量的指针. typedef unsigned int __kernel_size_t; typedef __ke ...

  6. Android:mimeType

    接收从其他应用传过来的数据,要用到清单文件 <activity android:name="com.terry.myActivity2" android:label=&quo ...

  7. Gauss elimination Template

    Gauss elimination : #include <iostream> #include <cstdlib> #include <cstring> #inc ...

  8. 为什么要用BASE64

    BASE64和其他相似的编码算法通常用于转换二进制数据为文本数据,其目的是为了简化存储或传输.更具体地说,BASE64算法主要用于转换二进 制数据为ASCII字符串格式.Java语言提供了一个非常好的 ...

  9. 用命令行方式关闭linux防火墙

    #/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT #/sbin/iptables -I INPUT -p tcp --dport 22 -j A ...

  10. Linux 下IOport编程訪问

    曾经写的一篇笔记.偶尔翻出来了,放在这里做个纪念 Linux 下IOport编程訪问 这里记录的方法是在用户态訪问IOport,不涉及驱动程序的编写. 首先要包括头文件 /usr/include/as ...