54262023-05-17 13:37:28TortelliniJrTáblajátékcpp17Wrong answer 15/504ms4256 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;
}
SubtaskSumTestVerdictTimeMemory
base15/50
1Wrong answer0/04ms1968 KiB
2Wrong answer0/03ms2240 KiB
3Partially correct1/33ms2232 KiB
4Partially correct1/33ms2560 KiB
5Partially correct1/33ms2776 KiB
6Partially correct1/33ms2984 KiB
7Partially correct1/33ms3016 KiB
8Partially correct1/33ms3264 KiB
9Partially correct1/33ms3260 KiB
10Partially correct1/34ms3368 KiB
11Partially correct1/33ms3624 KiB
12Partially correct1/33ms3832 KiB
13Partially correct1/44ms4056 KiB
14Partially correct1/43ms4256 KiB
15Partially correct1/43ms4216 KiB
16Partially correct1/44ms4240 KiB
17Partially correct1/43ms4152 KiB