17822022-12-03 14:23:37levente19Bimmbamm (30)cpp11Accepted 30/303ms3456 KiB
#include <bits/stdc++.h>
#define gyorsan ios::sync_with_stdio(0);cin.tie(0)

using namespace std;

int main()
{
    gyorsan;

    int n;
    cin >> n;

    int r;
    for(int i = 1; i < n+1; i++) {
        string s;
        cin >> s;
        if((i % 3 == 0) && (i % 5 != 0) && (s != "BIMM")) {
            r = i;
            break;
        }

        else if((i % 5 == 0) && (i % 3 != 0) && (s != "BAMM")) {
            r = i;
            break;
        }

        else if((i % 15 == 0) && (s != "BUMM")) {
            r = i;
            break;
        }

        else if((i % 3 != 0) && (i % 5 != 0) && (i % 15 != 0) && (s != "SZAM")) {
            r = i;
            break;
        }
    }

    cout << r << endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1960 KiB
2Accepted0/02ms2112 KiB
3Accepted3/32ms2332 KiB
4Accepted3/32ms2452 KiB
5Accepted3/32ms2660 KiB
6Accepted3/32ms2860 KiB
7Accepted3/32ms2868 KiB
8Accepted3/32ms2972 KiB
9Accepted3/32ms3052 KiB
10Accepted3/32ms3284 KiB
11Accepted3/32ms3316 KiB
12Accepted3/32ms3456 KiB