-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsol.cpp
More file actions
executable file
·44 lines (32 loc) · 1.52 KB
/
Copy pathsol.cpp
File metadata and controls
executable file
·44 lines (32 loc) · 1.52 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
#include <bits/stdc++.h>
using namespace std;
int getScore(string guesses, string answers)
{
int score = 0;
for (int i = 0; i < answers.length(); ++i)
if (guesses[i] == answers[i])
++score;
return score;
}
int main()
{
int n;
string answers;
cin >> n >> answers;
string adrian = "ABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABCABC";
string bruno = "BABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABCBABC";
string goran = "CCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABBCCAABB";
vector<pair<string, int>> scores = {
{"Adrian", getScore(adrian, answers)},
{"Bruno", getScore(bruno, answers)},
{"Goran", getScore(goran, answers)},
};
int maxi = (*max_element(scores.begin(), scores.end(), [](pair<string, int> a, pair<string, int> b)
{ return a.second < b.second; }))
.second;
cout << maxi << endl;
for (auto each : scores)
if (each.second == maxi)
cout << each.first << endl;
return 0;
}