mirea-projects/First term/Informatics/IT-2.md
2024-09-24 02:22:33 +03:00

287 lines
3.1 KiB
Markdown
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Рабочая тетрадь № 2
## Задачи № 1
### № 1
```math
101010 bin = 1 * 2 ^ 1 + 1 * 2 ^ 3 + 1 * 2 ^ 5 = 42 dec
```
### № 2
```math
563 oct = 3 * 8 ^ 0 + 6 * 8 ^ 1 + 5 * 8 ^ 2 = 371 dec
```
### № 3
```math
A1286 двенадцатиричной = 6 * 12 ^ 0 + 8 * 12 ^ 1 + 2 * 12 ^ 2 + 1 * 12 ^ 3 + 10 * 12 ^ 4 = 209478 dec
```
### № 4
```math
127 dec = 1111111 bin
7
```
## Задачи № 2
### № 1
```math
367 / 7 = 52 3
52 / 7 = 7 3
7 / 7 = 1 0
1 / 7 = 0 1
1033
```
### № 2
```math
1143 / 12 = 95 3
95 / 12 = 7 11
7 / 12 = 0 7
7B3
```
### № 3
```ma# Рабочая тетрадь № 2
## Задачи № 1
### № 1
```math
101010 bin = 1 * 2 ^ 1 + 1 * 2 ^ 3 + 1 * 2 ^ 5 = 42 dec
```
### № 2
```math
563 oct = 3 * 8 ^ 0 + 6 * 8 ^ 1 + 5 * 8 ^ 2 = 371 dec
```
### № 3
```math
A1286 двенадцатиричной = 6 * 12 ^ 0 + 8 * 12 ^ 1 + 2 * 12 ^ 2 + 1 * 12 ^ 3 + 10 * 12 ^ 4 = 209478 dec
```
### № 4
```math
127 dec = 1111111 bin
7
```th
127 oct = 7 * 8 ^ 0 + 2 * 8 ^ 1 + 1 * 8 ^ 2 = 87 dec
87 / 9 = 9 6
9 / 9 = 1 0
1 / 9 = 0 1
106
```
### № 4
```math
AB4 = 4 * 13 ^ 0 + 11 * 13 ^ 1 + 10 * 13 ^ 2 = 1837
1837 / 6 = 306 1
306 / 6 = 51 0
51 / 6 = 8 3
8 / 6 = 1 2
1 / 6 = 0 1
12301
```
## Задачи № 3
### № 1
```math
0010 1001 1101
29D
```
### № 2
```math
1 1 4 7 4 5 3
1001100111100101011
```
### № 3
```math
1 2 7
0000 0101 0111
57
```
### № 4
```math
C 3 E 1
110000111100001
8
```
### № 5
```math
A F 3 8
0101 0011 1100 0110 1001
53C69
001 010 011 110 001 101 001
1236151
1010011110001101001
```
## Тест № 2
1. A - 100101
2. C - 26
3. D - 11011000
4. B - X<Z<Y
5. C - 7
6. A - 3
7. C - 100000
8. 6 9 12
9. 5
10. 81
001011101010100000001110
001011101010100000001110
## Задачи № 4
### № 1
```python
n = int(input())
a = input()
print(int(a, n))
```
## Задачи № 5
### № 1
```python
a = int(input())
if a % 10 == 3 or a // 10 == 3:
print("Входит")
else:
print("Не входит")
```
### № 2
```python
a = int(input())
if a % 10 > a // 10:
print("Первая цифра больше")
elif a % 10 < a // 10:
print("Вторая цифра больше")
else:
print("Они одинаковые")
```
### № 3
```python
a = float(input())
b = float(input())
c = float(input())
d = b ** 2 - 4 * a * c
if d >= 0:
a1 = (-b + d ** 0.5) / (2 * a)
a2 = (-b - d ** 0.5) / (2 * a)
print(a1, a2)
else:
print("Корней нет")
```
## Задачи № 6
### № 1
```python
a = int(input())
i = 0
while a % i != 0:
i += 1
print(i)
```
### № 2
```python
a = int(input())
i = 0
while a != 0:
i += a
a -= 1
print(i)
```
### № 3
```python
a = int(input())
k = 0
for i in range(2, a // 2 + 1):
if a % i == 0:
k += 1
if k <= 0:
print("Простое")
else:
print("Не простое")
```
### № 4
```python
a = int(input())
n = int(input())
new = ""
while a > 0:
r = a % n
new += str(r)
a //= n
print(new[::-1])
```