Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <algorithm>
  5. #include <cmath>
  6. #include <iomanip>
  7. #include <stack>
  8. #include <map>
  9. #include <list>
  10. #include <cctype>
  11. #include <stack>
  12. #include <sstream>
  13. #include <set>
  14. #include <cstdio>
  15. #include <cstring>
  16. #include <climits>
  17.  
  18. using namespace std;
  19.  
  20. int main()
  21. {
  22.     string s, s1;
  23.     long h, t;
  24.  
  25.     cin >> t;
  26.     getline(cin, s);
  27.  
  28.     for(long i = 0; i < t; ++i){
  29.        
  30.         map<string, double> mymap;
  31.         h = 0;
  32.         getline(cin, s1);
  33.  
  34.         while (getline(cin, s)){
  35.            
  36.             mymap[s]++;
  37.             ++h;
  38.         }
  39.  
  40.         map<string, double>::iterator it;
  41.  
  42.         for(it = mymap.begin(); it != mymap.end(); ++it){
  43.             cout << it->first << ' ' << setiosflags(ios::fixed) << setprecision(4) << it->second*100/h << endl;
  44.         }
  45.  
  46.         if (i != t - 1) cout << endl;
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement