72782024-01-05 21:16:34gonterarminBimmbamm (30)cpp17Accepted 30/303ms3744 KiB
#include <iostream>

using namespace std;

int main() {
    int n,a=0;
    cin>>n;
    string s;
    for (int i = 1; i <= n; ++i) {
        cin>>s;
        a++;
        if (i%3==0 && i%5==0 && s!="BUMM") {cout<<i; return 0;}
        else if (i%3==0 && i%5==0 && s=="BUMM") continue;
        else if (i%3==0 && s!="BIMM") {cout<<i; return 0;}
        else if (i%5==0 && s!="BAMM") {cout<<i; return 0;}
        else if (i%3!=0 && i%5!=0 && s!="SZAM") {cout<<i; return 0;}
    }
    if (a==n) cout<<0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1812 KiB
2Accepted0/03ms2052 KiB
3Accepted3/33ms2260 KiB
4Accepted3/33ms2480 KiB
5Accepted3/33ms2692 KiB
6Accepted3/33ms3036 KiB
7Accepted3/33ms3216 KiB
8Accepted3/33ms3176 KiB
9Accepted3/32ms3172 KiB
10Accepted3/33ms3420 KiB
11Accepted3/33ms3500 KiB
12Accepted3/33ms3744 KiB