15482022-11-23 12:48:54zsebiBimmbamm (30)cpp11Wrong answer 18/303ms3216 KiB
#include <iostream>
#include <string>

using namespace std;
string s;
string a = "BIMM";
string b = "BAMM";
string c = "BUMM";
int n, ok, i;
int main()
{
    cin >> n;
    getline(cin, s);
    ok = 0;
    for (i = 1; i <= n; ++i)
    {
        cin >> s;

        if (i % 3 == 0 && i % 5 == 0)
        {
            if (s[1] != c[1])
            {
                cout << i;
                ok = 1;
                break;
            }
        }
        else if (i % 3 == 0)
        {
            if (s[1] != a[1])
            {

                cout << i;
                ok = 1;
                break;

            }
        }
        else if (i % 5 == 0)
        {

            if (s[1] != b[1])
            {

                cout << i;
                ok = 1;
                break;
            }
        }

    }
    if (ok == 0)cout << "0";
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base18/30
1Wrong answer0/03ms2128 KiB
2Wrong answer0/02ms2176 KiB
3Wrong answer0/32ms2144 KiB
4Wrong answer0/32ms2396 KiB
5Wrong answer0/32ms2600 KiB
6Accepted3/32ms2808 KiB
7Accepted3/32ms2972 KiB
8Accepted3/32ms3024 KiB
9Accepted3/32ms3092 KiB
10Wrong answer0/32ms3092 KiB
11Accepted3/32ms3092 KiB
12Accepted3/32ms3216 KiB