Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <cmath>
- #include <iomanip>
- #include <stack>
- #include <map>
- #include <list>
- #include <cctype>
- #include <stack>
- #include <sstream>
- #include <set>
- #include <cstdio>
- #include <cstring>
- #include <climits>
- using namespace std;
- int main()
- {
- string s, s1;
- long h, t;
- cin >> t;
- getline(cin, s);
- for(long i = 0; i < t; ++i){
- map<string, double> mymap;
- h = 0;
- getline(cin, s1);
- while (getline(cin, s)){
- mymap[s]++;
- ++h;
- }
- map<string, double>::iterator it;
- for(it = mymap.begin(); it != mymap.end(); ++it){
- cout << it->first << ' ' << setiosflags(ios::fixed) << setprecision(4) << it->second*100/h << endl;
- }
- if (i != t - 1) cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement