ответ:
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")
объяснение:
#include <iostream>#include <stdio.h>#include <time.h>
#define length 20
int main() { setlocale(LC_ALL, ""); srand(time(NULL));
int arr[length];
for (int i = 0; i < length; ++i) { arr[i] = rand() % 100 + 1; std::cout << arr[i] << "\n"; }
for (int i = 0; i < length; ++i) { if (arr[i] % 2 == 0) { for (int j = 0; j < length - 1; ++j) { if (arr[j] % 2 == 0) { if (arr[i] < arr[j]) {//сортировка будет происходить от Б к М int tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; } } } } }
std::cout << "\nsorted array\n\n"; for (int i = 0; i < length; ++i) { std::cout << arr[i] << "\n"; }
system("pause"); return 0;}
ответ:
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")
объяснение: