ответ:
n = int(
lstr = (" ")
ns = []
i = 0
tot = 0
while i < n:
ns.append(int(
tot += int(lstr[i])
i += 1
if tot % 5 == 0 and len(ns) > 4:
sm = int(tot / 5)
ns = sorted(ns, reverse=true)
ps = "yes"
su = 0
sk = 0
b = false
for n in ns:
if n ! = 0 and b:
su == 0
sk += 1
break
if sk == 5:
ps = "no"
su += n
if abs(su) > abs(sm):
if su == sm:
b = true
print(ps)
else:
print("no")
объяснение:
n, m, t = map(int,
x = list(map(int,
def build(name):
if name in built:
pass
elif b[a.index(name)] == ["0"]:
built.append(name)
for i in b[a.index(: ]:
if i not in built:
build(i)
a = []
b = []
built = []
for i in range(0, n):
a.append(
b.append(
for i in range(0, b.:
built.append(a[b.
a.pop(b.
b.pop(b.
[build(str(o)) for o in x]
print(len(built))
*
ответ:
n = int(
lstr = (" ")
ns = []
i = 0
tot = 0
while i < n:
ns.append(int(
tot += int(lstr[i])
i += 1
if tot % 5 == 0 and len(ns) > 4:
sm = int(tot / 5)
ns = sorted(ns, reverse=true)
ps = "yes"
su = 0
sk = 0
b = false
for n in ns:
if n ! = 0 and b:
su == 0
sk += 1
b = false
break
if sk == 5:
ps = "no"
break
su += n
if abs(su) > abs(sm):
ps = "no"
break
if su == sm:
b = true
print(ps)
else:
print("no")
объяснение:
ответ:
n, m, t = map(int,
x = list(map(int,
def build(name):
if name in built:
pass
elif b[a.index(name)] == ["0"]:
built.append(name)
else:
for i in b[a.index(: ]:
if i not in built:
build(i)
built.append(name)
a = []
b = []
built = []
for i in range(0, n):
a.append(
b.append(
for i in range(0, b.:
built.append(a[b.
a.pop(b.
b.pop(b.
[build(str(o)) for o in x]
print(len(built))
объяснение:
*