54202023-05-17 09:32:35TortelliniJrTáblajátékcpp17Hibás válasz 17/503ms4104 KiB

#include <iostream>
#include <vector>
#include <array>
#include <cmath>

using namespace std;

int main()
{
    int n, s, o, j;
	s = 1;
	o = 1;
    cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> j;
		switch (j)
		{
		case 0:
			s++;
			o *= 2;
			o--;
			break;
		case 1:
			s++, o *= 2;
			break;
		case 2:
			s--;
			o = ceil(o / 2);
		case 3:
			o--;
		case 4:
			o++;
		}
	}
	cout << s - 1 << endl;
	cout << o - 1 << endl;
}