-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExhibition.cpp
More file actions
57 lines (53 loc) · 1.49 KB
/
Exhibition.cpp
File metadata and controls
57 lines (53 loc) · 1.49 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
55
56
57
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
int main(){
int K;
int N, M, A;
set<int> stamps;
vector<set<int>> vet;
map<int,int> mapStampCount;
int countUnique = 0, countUniqueByFriend = 0;
//Setar casas decimais
std::cout << std::fixed;
std::cout << std::setprecision(6);
while (!cin.eof())
{
cin >> K;
for(int k = 0; k < K; k++){
cin >> N;
mapStampCount.clear();
vet.clear();
for(int n = 0; n < N; n++){
cin >> M;
stamps.clear();
for(int m = 0; m < M; m++){
cin >> A;
if(stamps.find(A) == stamps.end())
mapStampCount[A]++;
stamps.insert(A);
}
vet.push_back(stamps);
}
countUnique=0;
//Quantas cartas são unicas
for(auto msc: mapStampCount)
if(msc.second == 1)
countUnique++;
cout << "Case " << k+1 << ":";
for(auto v: vet){
countUniqueByFriend = 0;
for(auto stamp: v){
if(mapStampCount[stamp] == 1)
countUniqueByFriend++;
}
cout << " " << (countUniqueByFriend*100.0)/(double)countUnique << "%";
}
cout << endl;
}
return 0;
}
}