-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path10226.cpp
More file actions
54 lines (54 loc) · 1.22 KB
/
Copy path10226.cpp
File metadata and controls
54 lines (54 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* ____
* ____ ___ ____ ________ __/ __/
* / __ `__ \/ __ `/ ___/ / / / /_
* / / / / / / /_/ / / / /_/ / __/
* /_/ /_/ /_/\__,_/_/ \__,_/_/
*
* @link : https://the-redback.com
*/
#include <bits/stdc++.h>
using namespace std;
#define inf HUGE_VAL
#define mem(a, b) memset(a, b, sizeof(a))
#define mod 1000000007
map<string, int> mp;
string s;
string ss;
vector<string> v;
int main() {
char a[50];
int ret = 0;
int n, i;
double k, r;
int tc, t = 1;
scanf("%d", &tc);
getchar();
getchar();
while (tc--) {
i = 0;
while (gets(a)) {
if (strlen(a) == 0) break;
i++;
s.assign(a);
if (mp.find(s) == mp.end()) {
mp[s] = 1;
v.push_back(s);
} else
mp[s]++;
}
r = i;
sort(v.begin(), v.end());
if (t != 1) puts("");
for (i = 0; i < v.size(); i++) {
printf("%s ", v[i].c_str());
k = mp[v[i]];
double sum = (k / r) * 100.0;
printf("%.4lf\n", sum);
}
v.clear();
mp.clear();
t++;
}
return 0;
}