ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 2023. Donald is a postman

WA but its working correct any ideas?
Posted by nasafiy 16 Nov 2017 17:49
#include<iostream>
#include<cstdio>
using namespace std;

int main()
{

        int n, a = 1, counter = 0;
        string s;
        cin >> n;

        for (int i = 0; i < n; ++i)
         {
          cin >> s;
                if (s[0] == 'A' || s[0] == 'P' ||s[0] == 'O' ||s[0] == 'R' &&  a == 2){ a = 1; counter++;}
            else
                 if (s[0] == 'A' || s[0] == 'P' ||s[0] == 'O' ||s[0] == 'R' &&  a == 3){ a = 1; counter +=2;}

                 if (s[0] == 'B' || s[0] == 'M' ||s[0] == 'S' &&  a == 1){ a = 2; counter++;}

            else

                 if (s[0] == 'B' || s[0] == 'M' ||s[0] == 'S' &&  a == 3){ a = 2; counter++;}


                if (s[0] == 'D' || s[0] == 'G' ||s[0] == 'K' ||s[0] == 'T' || s[0] == 'W' &&  a == 1){ a = 3; counter +=2;}

            else

                if (s[0] == 'D' || s[0] == 'G' ||s[0] == 'K' ||s[0] == 'T' || s[0] == 'W' &&  a == 2){ a = 3; counter++;}



        }

        cout << counter;
        return 0;

}
Re: WA but its working correct any ideas?
Posted by Oleg Baskakov 17 Nov 2017 00:46
You list D, G, K, T, W, but not J.