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;
}