5426 2023. 05. 17 13:37:28 TortelliniJr Táblajáték cpp17 Hibás válasz 15/50 4ms 4256 KiB

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

using namespace std;

int main()
{
    int n, s, j;
	double o;
	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 = floor(o / 2);
			break;
		case 3:
			o--;
			break;
		case 4:
			o++;
			break;
		}
	}
	string t;
	if (o < 2)
	{
		t = to_string(o);
	}
	else
	{
		while (o > 0)
		{
			t = to_string(fmod(o, 2)) + t;
			o /= 2;
		}
	}
	cout << s << endl;
	cout << t << endl;
}
Részfeladat Összpont Teszt Verdikt Idő Memória
base 15/50
1 Hibás válasz 0/0 4ms 1968 KiB
2 Hibás válasz 0/0 3ms 2240 KiB
3 Részben helyes 1/3 3ms 2232 KiB
4 Részben helyes 1/3 3ms 2560 KiB
5 Részben helyes 1/3 3ms 2776 KiB
6 Részben helyes 1/3 3ms 2984 KiB
7 Részben helyes 1/3 3ms 3016 KiB
8 Részben helyes 1/3 3ms 3264 KiB
9 Részben helyes 1/3 3ms 3260 KiB
10 Részben helyes 1/3 4ms 3368 KiB
11 Részben helyes 1/3 3ms 3624 KiB
12 Részben helyes 1/3 3ms 3832 KiB
13 Részben helyes 1/4 4ms 4056 KiB
14 Részben helyes 1/4 3ms 4256 KiB
15 Részben helyes 1/4 3ms 4216 KiB
16 Részben helyes 1/4 4ms 4240 KiB
17 Részben helyes 1/4 3ms 4152 KiB