88942024-02-02 22:55:56radocziaronTáblajátékpython3Accepted 50/5018ms13588 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:
        x = x // 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/017ms11580 KiB
2Accepted0/018ms11932 KiB
3Accepted3/317ms12148 KiB
4Accepted3/317ms11948 KiB
5Accepted3/317ms12532 KiB
6Accepted3/317ms12308 KiB
7Accepted3/317ms12784 KiB
8Accepted3/317ms13044 KiB
9Accepted3/317ms12840 KiB
10Accepted3/317ms12776 KiB
11Accepted3/317ms13208 KiB
12Accepted3/317ms13588 KiB
13Accepted4/417ms13476 KiB
14Accepted4/417ms13240 KiB
15Accepted4/417ms13116 KiB
16Accepted4/417ms13564 KiB
17Accepted4/417ms13520 KiB