forked from fatemehkarimi/uvaSolutions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuva-10226.cpp
More file actions
45 lines (33 loc) · 880 Bytes
/
uva-10226.cpp
File metadata and controls
45 lines (33 loc) · 880 Bytes
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
//uva 10226
//Hardwood Species
#include <iostream>
#include <iomanip>
#include <map>
using namespace std;
int main(void)
{
int T = 0;
cin >> T;
string tree;
getline(cin, tree);
getline(cin, tree);
while (T--) {
int treeCount = 0;
map <string, int> trees;
while (1) {
getline(cin, tree);
if (tree == "")
break;
++trees[tree];
++treeCount;
}
/*for (auto a : trees)
cout << a.first << ' ' << a.second << ' ' << fixed << setprecision(4) << ((double)a.second / treeCount) * 100 << endl;
cout << treeCount << endl;*/
for (auto a : trees)
cout << a.first << ' ' << fixed << setprecision(4) << ((double)a.second / treeCount) * 100 << endl;
if (T != 0)
cout << endl;
}
return 0;
}