5423 2023. 05. 17 10:42:38 TortelliniJr Táblajáték cpp17 Hibás válasz 23/50 3ms 4072 KiB

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

using namespace std;

int main()
{
    int n, s, o, j;
	o = 0;
	s = 0;
    cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> j;
		switch (j)
		{
		case 0:
			s++;
			o *= 2;
			break;
		case 1:
			s++, o *= 2, o++;
			break;
		case 2:
			s--;
			o = ceil((double)o / 2);
		case 3:
			o--;
		case 4:
			o++;
		}
	}
	string t;
	if (o == 0)
	{
		t = "0";
	}
	while (o != 0)
	{
		t = to_string(o % 2) + t;
		o /= 2;
	}
	cout << s << endl;
	cout << t << endl;
}
Részfeladat Összpont Teszt Verdikt Idő Memória
base 23/50
1 Elfogadva 0/0 3ms 1748 KiB
2 Hibás válasz 0/0 3ms 1936 KiB
3 Elfogadva 3/3 3ms 2152 KiB
4 Elfogadva 3/3 3ms 2360 KiB
5 Elfogadva 3/3 3ms 2572 KiB
6 Részben helyes 1/3 3ms 2780 KiB
7 Részben helyes 1/3 3ms 2996 KiB
8 Részben helyes 1/3 3ms 3232 KiB
9 Részben helyes 1/3 3ms 3448 KiB
10 Részben helyes 1/3 3ms 3468 KiB
11 Elfogadva 3/3 3ms 3592 KiB
12 Részben helyes 1/3 3ms 3676 KiB
13 Részben helyes 1/4 3ms 3672 KiB
14 Részben helyes 1/4 3ms 3684 KiB
15 Részben helyes 1/4 3ms 3672 KiB
16 Részben helyes 1/4 3ms 3796 KiB
17 Részben helyes 1/4 3ms 4072 KiB