Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n,p,Score=0;
- char s;
- vector<char>v;
- cin >> n;
- for (int i=0;i<n;i++){
- cin >> p;
- for(int j=0;j<p;j++){
- cin >> s;
- v.push_back(s);
- Score=0;
- }
- while(!v.empty()){
- if(v[0]=='V'){
- Score+=5;
- v.erase(v.begin());
- }
- else if(v[0]=='W'){
- Score+=2;
- v.erase(v.begin());
- }
- else if(v[0]=='X'){
- if(v[1]=='V'){
- Score-=5;
- v.erase(v.begin() + l);
- }
- else if(v[1]=='W'){
- Score-=2;
- v.erase(v.begin() + l);
- }
- }
- if(v[0]=='Y'){
- v.push_back(v[1]);
- v.erase(v.begin());
- v.erase(v.begin());
- }
- if(v[0]=='Z'){
- if(v[1]=='V'){
- Score /= 5;
- }
- else if(v[1]=='W'){
- Score /= 2;
- }
- if(v[1]=='W' || v[1]=='V'){
- v.erase(v.begin()+1);
- }
- v.erase(v.begin());
- }
- }
- cout << Score <<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement