3.2 KiB
Executable File
3.2 KiB
Executable File
Рабочая тетрадь № 1
Задачи № 1
№ 1
4 mb = 4 * 1024 * 1024 * 8 bit = 33554432 bit
№ 2
2 gb = 2 * 1024 * 1024 * 1024 byte = 2147483648 byte
№ 3
6291456 byte = 6291456 / 1024 / 1024 mb = 6 mb
Задачи № 2
№ 1
log2(26) = 5 bit
№ 2
log2(5) = 3 bit
№ 3
log2(21) = 5 bit
Задачи № 3
№ 1
-0.5 * log2(0.5) = 0.5
-0.5 * log2(0.5) = 0.5
H = 0.5 + 0.5 = 1
№ 2
-1/6 * log2(1/6) = 0.431
-1/6 * log2(1/6) = 0.431
-1/6 * log2(1/6) = 0.431
-1/6 * log2(1/6) = 0.431
-1/6 * log2(1/6) = 0.431
-1/6 * log2(1/6) = 0.431
H = 0.431 + 0.431 + 0.431 + 0.431 + 0.431 + 0.431 = 2586
№ 3
-0.6 * log2(0.6) = 0.442
-0.4 * log2(0.4) = 0.529
H = 0.442 + 0.529 = 0.971
Задачи № 4
№ 1
77
№ 2
u
№ 3
73 74 75 64 65 6E 74
Задачи № 5
№ 1
110010010
№ 2
101000011
№ 3
Да
Задачи № 6
№ 1
00111011
000 000 111 111 111 000 111 111
№ 2
001 011 010 110 011 010 001 111
01011001
№ 3
CCz oYo mdm ppS uRu tpt wee Qrr __* Rss acc iBi eee nn% Fcc jee
Computer_science
Задачи № 7
№ 1
B 1010100
C 0011110
0110101
3
№ 2
A 0101010
B 1010100
C 0011110
ρ(A,B)
A 0101010
B 1010100
0000001
6
ρ(A,C)
A 0101010
C 0011110
1001011
3
ρ(B,C)
B 1010100
C 0011110
0110101
3
ρ(A,B) ≤ ρ(A,C) + ρ(C,B) - Да
ρ(A,C) ≤ ρ(A,B) + ρ(B,C) - Да
ρ(B,C) ≤ ρ(B,A) + ρ(A,C) - Да
Да
№ 3
d = min(6, 3, 3) = 3
3 >= 2n + 1
n = 1
Тест
- 1
- 3
- 2
- 4
- 4
- 2
- 3
- 1
- 3
- 4
Задачи № 8
№ 1
print("Калинин Никита Викторович ЭФБО-09-23")
№ 2
a = int(input())
b = int(input())
print(a + b)
№ 3
a = float(input())
print(x ** 5 - 2 * x ** 3 + 1)
Задачи № 9
№ 1
strange = [[], 1]
print(type(strange))
№ 2
for x in 0, 1:
for y in 0, 1:
if (x or y) and (not(x) or y) and not(x and y):
print(x, y)
№ 3
some_list = []
for i in range(4):
some_list.append(i)
for i in some_list[::-1]:
print(i)
Задачи № 10
№ 1
from math import log, ceil
def hartly(n: int) -> float:
return ceil(log(n, 2))
print(hartly(int(input())))
№ 2
from math import log
def entropy(p1, p2: float) -> float:
h1 = -1 * p1 * log(p1, 2)
h2 = -1 * p2 * log(p2, 2)
return h1 + h2
a = float(input())
b = float(input())
print(entropy(a, b))
№ 3
from math import tan, cos, sin, e, log
def some_func(x: float) -> float:
return tan(cos(x) * sin(2 * x) / x * e**x) ** log(x, 7)
x = float(input())
print(some_func(x))
№ 4
def parity_bit(string: str) -> str:
if string.count("1") % 2 == 0:
return string + "0"
return string + "1"
s = input()
print(parity_bit(s))