74502024-01-09 09:06:30BenedekMartonBimmbamm (30)cpp17Accepted 30/303ms3032 KiB
#include <iostream>
#include <cstring>
#include <fstream>

using namespace std;

int main()
{
    //ofstream cout("ki.txt");
    int n;
    char x[5];
    cin >> n;
    for(int i=1; i<=n; i++)
    {
        cin >> x;
        //cout << strcmp(x, "SZAM");
        if(strcmp(x, "SZAM")==0)
        {
            if(i%3==0 or i%5==0)
            {
                cout << i;
                return 0;
            }
        }
        else if(strcmp(x, "BIMM")==0)
        {
            if(i%3!=0 or i%5==0)
            {
                cout << i;
                return 0;
            }
        }
        else if(strcmp(x, "BAMM")==0)
        {
            if(i%3==0 or i%5!=0)
            {
                cout << i;
                return 0;
            }
        }
        else if(strcmp(x, "BUMM")==0)
        {
            if(i%3!=0 or i%5!=0)
            {
                cout << i;
                return 0;
            }
        }
    }
    cout << 0;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1880 KiB
2Accepted0/03ms2072 KiB
3Accepted3/33ms2204 KiB
4Accepted3/33ms2380 KiB
5Accepted3/33ms2592 KiB
6Accepted3/33ms2676 KiB
7Accepted3/33ms2676 KiB
8Accepted3/33ms2672 KiB
9Accepted3/33ms2680 KiB
10Accepted3/33ms2800 KiB
11Accepted3/33ms2920 KiB
12Accepted3/33ms3032 KiB