Помогите язык Питон Паскаль
Ответы
Ответ:
1)
n, k = map(int, input().split())
if n % k == 0:
print(n // k)
else:
print(n // k + 1)
2)
x1, x2, x3 = map(int, input().split())
if x1 < x2 and x1 < x3:
print((max(x2, x3)-x1)*2)
elif x1 > x2 and x1 > x3:
print((x1 - (min(x2, x3))) * 2)
else:
print((abs(x1-x2))*2 + (abs(x1-x3))*2)
3) не решил
4)
y = input()
s = sum([int(i) for i in y])
c = 0
for m in range(1, 13):
if m == 1 or m == 3 or m == 5 or m == 7 or m == 8 or m == 10 or m == 12:
for d in range(1, 32):
d = sum([int(i) for i in str(d)])
m = sum([int(i) for i in str(m)])
if (d + m) == s:
c += 1
elif m == 2:
if int(y) % 4 == 0:
for d in range(1, 30):
d = sum([int(i) for i in str(d)])
m = sum([int(i) for i in str(m)])
if (d + m) == s:
c += 1
else:
for d in range(1, 29):
d = sum([int(i) for i in str(d)])
m = sum([int(i) for i in str(m)])
if (d + m) == s:
c += 1
else:
for d in range(1, 31):
d = sum([int(i) for i in str(d)])
m = sum([int(i) for i in str(m)])
if (d + m) == s:
c += 1
print(c)