92882024-02-19 22:31:41abelke2Bimmbamm (30)cpp17Accepted 30/303ms3368 KiB
#include <iostream>
#include <string>

using namespace std;

int firstMistakeIndex = 0;

void setFirstMistake(int index, bool& done)
{
	done = true;
	firstMistakeIndex = index;
}

int main()
{
	int rounds = 0;
	string word = "";

	cin >> rounds;

	int i = 1;
	bool done = false;
	while(i <= rounds && !done)
	{
		cin >> word;
		if (i % 3 == 0 && i % 5 == 0)
		{
			if (word != "BUMM")
				setFirstMistake(i, done);
		}
		else if (i % 3 == 0)
		{
			if(word != "BIMM")
				setFirstMistake(i, done);
		}
		else if (i % 5 == 0)
		{
			if(word != "BAMM")
				setFirstMistake(i, done);
		}
		else if (word != "SZAM")
		{
			setFirstMistake(i, done);
		}
		++i;
	}

	cout << firstMistakeIndex;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1812 KiB
2Accepted0/03ms1848 KiB
3Accepted3/33ms2072 KiB
4Accepted3/33ms2292 KiB
5Accepted3/33ms2508 KiB
6Accepted3/33ms2720 KiB
7Accepted3/33ms2960 KiB
8Accepted3/33ms3212 KiB
9Accepted3/33ms3300 KiB
10Accepted3/33ms3276 KiB
11Accepted3/33ms3284 KiB
12Accepted3/33ms3368 KiB