|
|
вернуться в форумWA but its working correct any ideas? #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? You list D, G, K, T, W, but not J. |
|
|