//poj 2418 Hardwood Species(使用STL map)
#include<iostream>
#include<cstdio>
#include<string>
#include<iostream>
#include<map>
using namespace std;
map<string,int> mp;
map<string,int>::iterator it;
int main()
{
char a[33];
string str;
int n=0;
while(gets(a)!=NULL)
{
str=a;
mp[str]++;
n++;
}
for(it=mp.begin();it!=mp.end();it++)
{
cout<<it->first<<" ";
printf("%0.4lf\n",((double)(it->second)/(double)n)*100);
}
return 0;
}
poj 2418 Hardwood Species(使用STL map)
最新推荐文章于 2017-01-21 15:12:29 发布