Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. int main()
  7. {
  8.  
  9. int n,p,Score=0;
  10. char s;
  11. vector<char>v;
  12. cin >> n;
  13. for (int i=0;i<n;i++){
  14. cin >> p;
  15. for(int j=0;j<p;j++){
  16. cin >> s;
  17. v.push_back(s);
  18. Score=0;
  19. }
  20.  
  21.  
  22. while(!v.empty()){
  23.  
  24. if(v[0]=='V'){
  25. Score+=5;
  26. v.erase(v.begin());
  27. }
  28. else if(v[0]=='W'){
  29. Score+=2;
  30. v.erase(v.begin());
  31. }
  32.  
  33.  
  34. else if(v[0]=='X'){
  35. if(v[1]=='V'){
  36. Score-=5;
  37. v.erase(v.begin() + l);
  38. }
  39. else if(v[1]=='W'){
  40. Score-=2;
  41. v.erase(v.begin() + l);
  42. }
  43. }
  44.  
  45.  
  46. if(v[0]=='Y'){
  47. v.push_back(v[1]);
  48. v.erase(v.begin());
  49. v.erase(v.begin());
  50. }
  51. if(v[0]=='Z'){
  52. if(v[1]=='V'){
  53. Score /= 5;
  54. }
  55. else if(v[1]=='W'){
  56. Score /= 2;
  57. }
  58. if(v[1]=='W' || v[1]=='V'){
  59. v.erase(v.begin()+1);
  60. }
  61. v.erase(v.begin());
  62. }
  63. }
  64. cout << Score <<endl;
  65. }
  66.  
  67. return 0;
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement