c++过得,G++ 不知为啥过不了……&…………
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
int main()
{
map<string , int>M;
map<string , int>::iterator it;
char name[35];
int num = 0;
while(gets(name) != NULL)
{
if(strcmp(name , "") == 0) continue;
M[name] ++ ;
num ++ ;
}
for(it = M.begin() ; it != M.end() ; it++)
{
//printf("%s %.2lf\n" , it -> first , it -> second * 1.0/ num);
// std::cout.precision(5);
cout << it -> first << " "; //<< setprecision(5) << (((it -> second) * 1.0 )/ num )* 100<< endl;
printf("%.4lf\n" ,(((it -> second) * 1.0 )/ num )* 100);
}
return 0 ;
}