-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathR. String Score.cpp
More file actions
40 lines (39 loc) · 911 Bytes
/
R. String Score.cpp
File metadata and controls
40 lines (39 loc) · 911 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
//https://codeforces.com/group/MWSDmqGsZm/contest/219856/problem/R
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
string str;
ll n,score = 0;
cin>>n;
cin>>str;
for(ll i =0; i<n; i++)
{
if(str[i] == 'V') score += 5;
else if(str[i] == 'W') score += 2;
else if(str[i] == 'X' && i != (n-1)) str[i+1] = '-';
else if(str[i] == 'Y' && i != (n-1))
{
str += str[i+1];
n++;
str[i+1] = '-';
}
else if(str[i] == 'Z' && i != (n-1))
{
if(str[i+1] == 'V')
{
score /= 5;
str[i+1] = '-';
}
if(str[i+1] == 'W')
{
score /= 2;
str[i+1] = '-';
}
}
}
cout<<score;
}