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. setuptools,easy_install使用

    当需要安装第三方python包时,可能会用到easy_install命令.easy_install是由PEAK(Python Enterprise Application Kit)开发的setupto ...

  2. Windows Azure 社区新闻综述(#75 版)

    欢迎查看最新版本的每周综述,其中包含有关云计算和 Windows Azure 的社区推动新闻.内容和对话.以下是本周的亮点. 文章.视频和博客文章 ·   PowerShell 对 Windows A ...

  3. java学习之反射

    package com.gh.ref; public class Person { private String name; private int age; private char sex; pr ...

  4. ThinkPHP - 连贯操作

    /** * 连贯操作 * @return 无返回值 */ public function coherentOperation(){ //实例化模型 $user = M('User'); // +--- ...

  5. 写一方法计算实现任意个整数之和.在主调函数中调用该函数,实现任意个数之和。(使用params参数)

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...

  6. ARM异常---一个DataAbort的触发过程:

    一个DataAbort异常的触发过程://////////////////////////////xxxx.inc_STACK_BASEADDRESS EQU 0x33ff8000_MMUTT_STA ...

  7. python学习(一)

    1 python一切皆为对象,因为现实 包含了一系列的数据和操作这些数据的方法的一个整体,就叫作对象. 自行车 属性:手刹车,轮胎,脚踏板方法:如何前进的方法,控制停止的方法,控制方向 实际内容 男人 ...

  8. web Listener

    在web应用内部会不断地发生各种事件例如,web应用被启动,web应用停止,用户session开始,用户session 结束,用户请求到达,通常这些事件对开发者而言是透明的.实际上ServletAPI ...

  9. 利用httpclient和多线程刷訪问量代码

    缘起于玩唱吧,由于唱吧好友少,訪问量低,又不想加什么亲友团之类的,主要是太麻烦了,于是我就琢磨唱吧的訪问机制,准备用java的httpclient库来进行刷訪问量,想到动态IP反复使用就想到了用多线程 ...

  10. 另外一种方式装win2008r2

    装系统有很多方法,但是这种,我很少用. 注意第二个红圈处,是要启动的电话引导盘符.容易选择你的启动U盘,如果是后者,表现出的结果就是引导U盘不能引导,且安装的电脑也会显示ntdl丢失.当然,也可以解决 ...