88902024-02-02 22:10:25radocziaronTáblajátékpython3Accepted 50/5017ms12964 KiB
k = int(input())
lista = list(map(int,input().split()))
x = 0
y = 0

for i in range(k):
    if lista[i] == 0:
        x = 2*x
        y += 1
    elif lista[i] == 1:
        x = (2*x)+1
        y += 1
    elif lista[i] == 2:
        if x % 2 == 0:
            x = x // 2
        else:
            x = (x-1) // 2
        y -= 1
    elif lista[i] == 3:
        x -= 1
    elif lista[i] == 4:
        x += 1
print(y)
print(format(x,"b"))
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/017ms11616 KiB
2Accepted0/017ms11796 KiB
3Accepted3/317ms11540 KiB
4Accepted3/317ms12040 KiB
5Accepted3/317ms12104 KiB
6Accepted3/317ms12016 KiB
7Accepted3/317ms12544 KiB
8Accepted3/317ms12652 KiB
9Accepted3/317ms12444 KiB
10Accepted3/317ms12552 KiB
11Accepted3/317ms12640 KiB
12Accepted3/317ms12664 KiB
13Accepted4/417ms12944 KiB
14Accepted4/417ms12964 KiB
15Accepted4/417ms12864 KiB
16Accepted4/417ms12848 KiB
17Accepted4/417ms12628 KiB