Hdu1800-Flying to the Mars(stl map函数初试水)

链接如下:

Problem - 1800

试一下map函数.


这篇文章的生词有

empire 帝国

nonnegative integer 非负整数

eligible 合适的,有资格的


#include<stdio.h>

#include<map>

using namespace std;

int main()

{

  int i,n,max;

  map<int,int>mp;

  while(scanf("%d",&n)!=EOF){

mp.clear();

while(n--){

scanf("%d",&i);

mp[i]++;

}

map<int,int>::iterator it;

max=0;

for(it=mp.begin();it!=mp.end();it++)

if(max<it->second) max=it->second;

printf("%d\n",max);

}

return 0;

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容