79842024-01-12 09:41:16CsongiTáblajátékcpp17Partially correct 38/503ms4176 KiB
#include <iostream>
#include <bits/stdc++.h>
#include <bitset>

using namespace std;


void binaris(unsigned long long int n)
{
    if (n / 2 != 0) {
        binaris(n / 2);
    }
    printf("%d", n % 2);
}

int main()
{
    short int k;
    cin >> k;
    vector<short int> szamok(k);
    unsigned long long int jelenmezo = 0;
    double jelensor = 0;
    for (short int i = 0; i < k; i++)
    {
        cin >> szamok[i];
        switch (szamok[i])
        {
        case 0:
            jelensor++;
            if (jelenmezo != 0)
                jelenmezo *= 2;
            break;
        case 1:
            jelensor++;
            jelenmezo = (jelenmezo*2)+1;
            break;
        case 2:
            jelenmezo = ceil(jelenmezo / 2);
            jelensor--;
            break;
        case 3:
            if (jelenmezo != 0)
                jelenmezo--;
            break;
        case 4:
            jelenmezo++;
            break;
        }
    }
    cout << jelensor << endl;
    binaris(jelenmezo);
}
SubtaskSumTestVerdictTimeMemory
base38/50
1Accepted0/03ms1876 KiB
2Accepted0/03ms2120 KiB
3Accepted3/33ms2360 KiB
4Accepted3/33ms2556 KiB
5Accepted3/33ms2700 KiB
6Partially correct1/33ms2952 KiB
7Accepted3/33ms3004 KiB
8Accepted3/33ms3000 KiB
9Accepted3/33ms3244 KiB
10Partially correct1/33ms3456 KiB
11Accepted3/33ms3552 KiB
12Partially correct1/33ms3760 KiB
13Accepted4/43ms3980 KiB
14Partially correct1/43ms4092 KiB
15Accepted4/43ms4060 KiB
16Partially correct1/43ms4176 KiB
17Accepted4/43ms4172 KiB