-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimulat.cpp
57 lines (49 loc) · 1.26 KB
/
simulat.cpp
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 <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0), ios::sync_with_stdio(0);
string s;
vector<string>rec[64];
double cnt=0,miss=0;
while(getline(cin,s)){
++cnt;
int set_number=0;
string tag,set;
for(int i=0;i<=19;i++){
tag+=s[i];
}
for(int i=20;i<=25;i++){
set+=s[i];
}
for(int i=20;i<=25;i++){
set_number=set_number*2+(s[i]-'0');
}
bool flag=false;
for(auto tmp:rec[set_number]){
if(tmp==tag){
flag=true;
}
}
if(flag){
for(auto it=rec[set_number].begin();it!=rec[set_number].end();it++){
if(*it==tag){
rec[set_number].erase(it);
break;
}
}
rec[set_number].push_back(tag);
}
else{
++miss;
if(rec[set_number].size()<4){
rec[set_number].push_back(tag);
}
else{
rec[set_number].erase(rec[set_number].begin());
rec[set_number].push_back(tag);
}
}
}
cout<<setprecision(10)<<miss*100/cnt<<"%"<<endl;
return 0;
}