
Var a, d, n, i, otv: integer;
begin
read(a,d,n); - ввод всех значений
otv:=a; - в переменную где будет храниться
for i:=1 to n do ответ записываем начальный взнос
begin
a:=a+d; - увеличиваем в цикле взнос
otv:= otv + (a); - добовляем взнос к нашему ответу
end;
writeln(otv); - выводим ответ
end.
ответ:
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")
объяснение: