POJ 2418

简介: #include #include #include #include #include using namespace std; int main() { string s; int cnt=0; map tree;//一对一映射 ...
#include <iostream>
#include <string>
#include <map>
#include <iterator>
#include <cstdio>
using namespace std;
int main()
{
    string s;
    int cnt=0;
    map<string,int> tree;//一对一映射 
    while(getline(cin,s))
    {
        tree[s]++;//数组方式 
        cnt++;
    }
    map<string,int>::iterator iter;
    for(iter=tree.begin();iter!=tree.end();iter++)
    {
        cout<<iter->first;
        printf(" %.4f\n",iter->second*100.0/cnt);
        //cout<<iter->first<<' '<<fixed<<setprecision(4)<<iter->second*100.0/num*1.0<<endl;
    }
    return 0;
}

目录
相关文章
POJ 2027 No Brainer
POJ 2027 No Brainer
108 0
POJ 1804
题目:http://poj.org/problem?id=1804 大意:给你一串数字,排序。求出最少的交换次数  \ 我用归并做的 #include #include using namespace std; int aa[500010],bb[500010]; long lon...
695 0
POJ 2027 No Brainer
Problem Description Zombies love to eat brains. Yum. Input The first line contains a single integer n indicating the number of data sets.
866 0
|
算法 机器人 编译器
POJ-2632
#include int main() { int k,a,b,n,m,i,j,num,rep,rect[100][100],robot[100][3]; int flag; char c; for(scanf("%d...
919 0
|
消息中间件 人工智能 JavaScript
|
机器学习/深度学习
|
算法 计算机视觉
最小割-poj-2914
poj-2914-Minimum Cut Description Given an undirected graph, in which two vertices can be connected by multiple edges, what is the size of the minimum cut of the graph? i.e. how many edges must b
1558 0