17912022-12-03 17:25:39kdbBimmbamm (30)cpp11Accepted 30/303ms3120 KiB
#include <iostream>
using namespace std;
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int n, m=0;
    cin >> n;
    for (size_t i = 1; i < n + 1; i++)
    {
        string q;
        cin >> q;
        if (i % 3 == 0 && i % 5 != 0 && q != "BIMM")
        {
            m = i;
            break;
        }
        else if (i % 3 != 0 && i % 5 == 0 && q != "BAMM")
        {
            m = i;
            break;
        }
        else if (i % 3 == 0 && i % 5 == 0 && q != "BUMM")
        {
            m = i;
            break;
        }
        else if (i % 3 != 0 && i % 5 != 0 && q != "SZAM")
        {
            m = i;
            break;
        }
    }
    cout << m << endl;
    return 0;
}
/*
4
SZAM
SZAM
BIMM
BIMM
-4

5
SZAM
SZAM
BAMM
SZAM
SZAM
-3
*/
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1828 KiB
2Accepted0/02ms2064 KiB
3Accepted3/32ms2260 KiB
4Accepted3/32ms2464 KiB
5Accepted3/32ms2544 KiB
6Accepted3/32ms2668 KiB
7Accepted3/32ms2868 KiB
8Accepted3/32ms2948 KiB
9Accepted3/32ms2916 KiB
10Accepted3/32ms3040 KiB
11Accepted3/32ms3120 KiB
12Accepted3/32ms3120 KiB