CPP
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
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
string names[5];
string yrname;
cin>>yrname;
names[0] = yrname;
int nagents;
cin>>nagents;
for(int i=1;i<5;++i)
cin >> names[i];
sort(begin(names), end(names));
auto pos = find(begin(names), end(names),yrname);
auto mypos = pos-begin(names)+1;
if(mypos==1 || nagents > 4) {
cout << 20;
}
else if(mypos==2) {
if (nagents==1) cout<<40;
else if(nagents==2)cout<<20;
else if(nagents==3)cout<<20;
else if(nagents==4)cout<<20;
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run