首页 > 编程语言 > 详细

uva-10420-排序

时间:2017-07-16 18:08:01      阅读:365      评论:0      收藏:0      [点我收藏+]

根据国家名字统计人数,然后排序

#include<stdio.h>
#include<iostream>
#include<queue>
#include<map>
#include<memory.h>
#include <math.h>
#include<time.h>
#include <stdlib.h>
using namespace std;

struct Node
{
    string key;
    int total;
};
int main()
{
    freopen("d:\\1.txt","r",stdin);
    int n;
    cin>>n;
    map<string,int>maps;
    string str;
    for(int i = 0; i< n;i++)
    {
        cin>>str;
        int j  = maps[str];
        j++;
        maps[str] = j;
        getline(cin,str);
    }
    map<string,int>::iterator iter;
    for(iter = maps.begin(); iter != maps.end(); ++iter)
    {
        cout<<iter->first<<" "<<iter->second<<endl;
    }

    return 0;
}

 

uva-10420-排序

原文:http://www.cnblogs.com/shuiyonglewodezzzzz/p/7191111.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!