Advertisement
Rimifawfaw

uva 10226

Jan 31st, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #include<bits/stdc++.h>//rimi
  2. using namespace std;
  3. #define max 100005
  4. int ar[max];
  5. vector<int >tree(max*4);
  6. int k=1;
  7. pair<int, int> t[4*100];
  8.  
  9. int main()
  10. {
  11.  
  12. ios_base::sync_with_stdio(false);
  13. cin.tie(NULL);
  14.  
  15. long long int z,m,a,b,c,t,i,j,n,k,h,e,w,q,l,o,d;
  16. double dou;
  17. string s1,s2,str;
  18. map<string, int>ma;
  19. map<string, int>::iterator it;
  20. scanf("%d\n\n", &t);
  21. char s[40];
  22.  
  23. for(i=0;i<t;i++)
  24. {
  25. n=0;
  26.  
  27. while( gets(s))
  28. {
  29. // cin.ignore();
  30. if (strlen(s) == 0)
  31. break;
  32. else
  33. {
  34. ma[s]++;
  35. }
  36.  
  37. n++;
  38. }
  39.  
  40. for( it=ma.begin();it != ma.end();it++)
  41. {
  42.  
  43. printf("%s %.4lf\n", (*it).first.data(),(double) (*it).second / (double) n * 100.0);
  44.  
  45.  
  46. }
  47. printf("\n");
  48. ma.clear();
  49. }
  50.  
  51.  
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement